Part 1

DOMAIN: Automobile

CONTEXT: The data concerns city-cycle fuel consumption in miles per gallon, to be predicted in terms of 3 multivalued discrete and 5 continuous attributes

PROJECT OBJECTIVE: Goal is to cluster the data and treat them as individual datasets to train Regression models to predict ‘mpg’

1. Import and warehouse data:

Import all the given datasets and explore shape and size.
• Merge all datasets onto one and explore final shape and size.
• Export the final dataset and store it on local machine in .csv, .xlsx and .json format for future use.
• Import the data from above steps into python.

In [1]:
#import libraries that will be used for EDA
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.stats import zscore
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn import preprocessing
from sklearn.metrics import average_precision_score, confusion_matrix, accuracy_score, classification_report, plot_confusion_matrix
import warnings
warnings.filterwarnings('ignore')
from sklearn.decomposition import PCA
In [2]:
#Load the data from Json file
import json

P1 = json.load(open('Part1 - Car-Attributes.json'))
P1_Data = pd.DataFrame(P1)
P1_Data
Out[2]:
mpg cyl disp hp wt acc yr origin
0 18.0 8 307.0 130 3504 12.0 70 1
1 15.0 8 350.0 165 3693 11.5 70 1
2 18.0 8 318.0 150 3436 11.0 70 1
3 16.0 8 304.0 150 3433 12.0 70 1
4 17.0 8 302.0 140 3449 10.5 70 1
... ... ... ... ... ... ... ... ...
393 27.0 4 140.0 86 2790 15.6 82 1
394 44.0 4 97.0 52 2130 24.6 82 2
395 32.0 4 135.0 84 2295 11.6 82 1
396 28.0 4 120.0 79 2625 18.6 82 1
397 31.0 4 119.0 82 2720 19.4 82 1

398 rows × 8 columns

In [3]:
P1_names = pd.read_csv('Part1 - Car name.csv')
P1_names
Out[3]:
car_name
0 chevrolet chevelle malibu
1 buick skylark 320
2 plymouth satellite
3 amc rebel sst
4 ford torino
... ...
393 ford mustang gl
394 vw pickup
395 dodge rampage
396 ford ranger
397 chevy s-10

398 rows × 1 columns

In [4]:
P1_Data = pd.concat([P1_Data, P1_names], axis = 1)
P1_Data.shape
#So now we have 398 observations with 9 different features
Out[4]:
(398, 9)
In [5]:
P1_Data.to_csv("Part 1 - Automobile.csv" , index = False)
In [6]:
Automobile = pd.read_csv('Part 1 - Automobile.csv')
In [7]:
Automobile.shape
Out[7]:
(398, 9)

2. Data cleansing:

• Missing/incorrect value treatment
• Drop attribute/s if required using relevant functional knowledge
• Perform another kind of corrections/treatment on the data.

In [8]:
#Lets have first look at the data
Automobile.head()
Out[8]:
mpg cyl disp hp wt acc yr origin car_name
0 18.0 8 307.0 130 3504 12.0 70 1 chevrolet chevelle malibu
1 15.0 8 350.0 165 3693 11.5 70 1 buick skylark 320
2 18.0 8 318.0 150 3436 11.0 70 1 plymouth satellite
3 16.0 8 304.0 150 3433 12.0 70 1 amc rebel sst
4 17.0 8 302.0 140 3449 10.5 70 1 ford torino
In [9]:
Automobile.info()
#we have all non null columns but then HP being the numeric is displayed as object data type
#we have to get insights of the hp data
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 398 entries, 0 to 397
Data columns (total 9 columns):
 #   Column    Non-Null Count  Dtype  
---  ------    --------------  -----  
 0   mpg       398 non-null    float64
 1   cyl       398 non-null    int64  
 2   disp      398 non-null    float64
 3   hp        398 non-null    object 
 4   wt        398 non-null    int64  
 5   acc       398 non-null    float64
 6   yr        398 non-null    int64  
 7   origin    398 non-null    int64  
 8   car_name  398 non-null    object 
dtypes: float64(3), int64(4), object(2)
memory usage: 28.1+ KB
In [10]:
Automobile.describe(include = "all").T
#Clearly there are some non numeric data which needs to be take care of
Out[10]:
count unique top freq mean std min 25% 50% 75% max
mpg 398 NaN NaN NaN 23.5146 7.81598 9 17.5 23 29 46.6
cyl 398 NaN NaN NaN 5.45477 1.701 3 4 4 8 8
disp 398 NaN NaN NaN 193.426 104.27 68 104.25 148.5 262 455
hp 398 94 150 22 NaN NaN NaN NaN NaN NaN NaN
wt 398 NaN NaN NaN 2970.42 846.842 1613 2223.75 2803.5 3608 5140
acc 398 NaN NaN NaN 15.5681 2.75769 8 13.825 15.5 17.175 24.8
yr 398 NaN NaN NaN 76.0101 3.69763 70 73 76 79 82
origin 398 NaN NaN NaN 1.57286 0.802055 1 1 1 2 3
car_name 398 305 ford pinto 6 NaN NaN NaN NaN NaN NaN NaN
In [11]:
# isdigit()? on 'hp' 
hpIsDigit = pd.DataFrame(Automobile.hp.str.isdigit())  # if the string is made of digits store True else False

#print isDigit = False!
Automobile[hpIsDigit['hp'] == False]
Out[11]:
mpg cyl disp hp wt acc yr origin car_name
32 25.0 4 98.0 ? 2046 19.0 71 1 ford pinto
126 21.0 6 200.0 ? 2875 17.0 74 1 ford maverick
330 40.9 4 85.0 ? 1835 17.3 80 2 renault lecar deluxe
336 23.6 4 140.0 ? 2905 14.3 80 1 ford mustang cobra
354 34.5 4 100.0 ? 2320 15.8 81 2 renault 18i
374 23.0 4 151.0 ? 3035 20.5 82 1 amc concord dl
In [12]:
# Missing values have a'?''
# Replace missing values with NaN
Automobile = Automobile.replace('?', np.nan)
Automobile[hpIsDigit['hp'] == False] 
Out[12]:
mpg cyl disp hp wt acc yr origin car_name
32 25.0 4 98.0 NaN 2046 19.0 71 1 ford pinto
126 21.0 6 200.0 NaN 2875 17.0 74 1 ford maverick
330 40.9 4 85.0 NaN 1835 17.3 80 2 renault lecar deluxe
336 23.6 4 140.0 NaN 2905 14.3 80 1 ford mustang cobra
354 34.5 4 100.0 NaN 2320 15.8 81 2 renault 18i
374 23.0 4 151.0 NaN 3035 20.5 82 1 amc concord dl
In [13]:
Automobile['hp'].median() # note the mdedian of the hp column
Out[13]:
93.5
In [14]:
Automobile.isnull().any() # check on all the feature contaning null values
Out[14]:
mpg         False
cyl         False
disp        False
hp           True
wt          False
acc         False
yr          False
origin      False
car_name    False
dtype: bool
In [15]:
# Since we have only hp column with Null values,we can fill out NA values with median of hp
Automobile = Automobile.fillna(Automobile['hp'].median())
Automobile[hpIsDigit['hp'] == False] 
Out[15]:
mpg cyl disp hp wt acc yr origin car_name
32 25.0 4 98.0 93.5 2046 19.0 71 1 ford pinto
126 21.0 6 200.0 93.5 2875 17.0 74 1 ford maverick
330 40.9 4 85.0 93.5 1835 17.3 80 2 renault lecar deluxe
336 23.6 4 140.0 93.5 2905 14.3 80 1 ford mustang cobra
354 34.5 4 100.0 93.5 2320 15.8 81 2 renault 18i
374 23.0 4 151.0 93.5 3035 20.5 82 1 amc concord dl
In [16]:
Automobile.isnull().any() # Rechek for NULL values in any columns
Out[16]:
mpg         False
cyl         False
disp        False
hp          False
wt          False
acc         False
yr          False
origin      False
car_name    False
dtype: bool
In [17]:
Automobile['hp'] = Automobile['hp'].astype('float64')  # converting the hp column from object / string type to float
In [18]:
#Looking at the data we can say that car name is not usefull to achive our objective,
#Hence we can drop the car name column
Automobile = Automobile.drop('car_name', axis = 1)
Automobile.shape #confirmation on car_name column is dropped
Out[18]:
(398, 8)
In [19]:
#SInce we have analysed and understood the data distribution, 
#now lets logically manipulate the data for better understandability
#Year as a column can be replaced with the Age of the car column which inturn will give better understandability of the data
Automobile['age'] = 83 - Automobile['yr']
Automobile['age'].describe()
Out[19]:
count    398.000000
mean       6.989950
std        3.697627
min        1.000000
25%        4.000000
50%        7.000000
75%       10.000000
max       13.000000
Name: age, dtype: float64
In [20]:
# we can drop the yr column now
Automobile = Automobile.drop('yr', axis = 1)
Automobile.head() #confirmation on car_name column is dropped
Out[20]:
mpg cyl disp hp wt acc origin age
0 18.0 8 307.0 130.0 3504 12.0 1 13
1 15.0 8 350.0 165.0 3693 11.5 1 13
2 18.0 8 318.0 150.0 3436 11.0 1 13
3 16.0 8 304.0 150.0 3433 12.0 1 13
4 17.0 8 302.0 140.0 3449 10.5 1 13

Data analysis & visualisation:

• Perform detailed statistical analysis on the data.
• Perform a detailed univariate, bivariate and multivariate analysis with appropriate detailed comments after each analysis.

In [21]:
#Lets check the distribution of each feature
Automobile.hist(color='lightblue', edgecolor = 'black', alpha = 0.7, figsize = (20,10), layout=(3,3))
plt.tight_layout()
plt.show()
# We can see only acc feature is normally distributed
In [22]:
# For Skewness, closer the value to 0, perfectly the distribution follows normal distribution
#negative skew: The left tail is longer; the mass of the distribution is concentrated on the right of the figure.
#positive skew: The right tail is longer; the mass of the distribution is concentrated on the left of the figure.
Automobile.skew()

#We can infer that distribution is quite good as we dont have any extreme skewed distribution except for horsepower 
Out[22]:
mpg       0.457066
cyl       0.526922
disp      0.719645
hp        1.106224
wt        0.531063
acc       0.278777
origin    0.923776
age      -0.011535
dtype: float64
In [23]:
#Lets cehck the presence of outliers in the data set
for columns in Automobile:
    plt.figure()
    plt.title(columns)
    sns.boxplot(data = Automobile[columns], orient="h")

# We can observe that Milage, horsepower and acceleration have presence of outliers 
# Presence of ouliers will impact clustering models because of its extreme outlying distance from the distribution
In [24]:
sns.pairplot(Automobile , diag_kind='kde')
#From this single visual representation we can make infrences on univariate and bivariate distributions
Out[24]:
<seaborn.axisgrid.PairGrid at 0x1a30730f220>
In [25]:
# pairplot can be used as a one place to analyse entre data distribution and correlation
# From above we can see that individual distribution is near to normal distribution for most of the features
# except for Origin and cylinders.
# From above we can also infer that based on the distribution curves, we can have probably 3 clusters under this data set
# correlation of milage follows negative slope with displacement, horsepower and weight 
# which means Milage starts reducing with increase in these 3 values
In [26]:
Automobile.corr()
# As per our previous assumption,
# we have negative correlation between milage and (displacement, horsepower, weight, cylnders)
Out[26]:
mpg cyl disp hp wt acc origin age
mpg 1.000000 -0.775396 -0.804203 -0.773453 -0.831741 0.420289 0.563450 -0.579267
cyl -0.775396 1.000000 0.950721 0.841284 0.896017 -0.505419 -0.562543 0.348746
disp -0.804203 0.950721 1.000000 0.895778 0.932824 -0.543684 -0.609409 0.370164
hp -0.773453 0.841284 0.895778 1.000000 0.862442 -0.686590 -0.452096 0.413733
wt -0.831741 0.896017 0.932824 0.862442 1.000000 -0.417457 -0.581024 0.306564
acc 0.420289 -0.505419 -0.543684 -0.686590 -0.417457 1.000000 0.205873 -0.288137
origin 0.563450 -0.562543 -0.609409 -0.452096 -0.581024 0.205873 1.000000 -0.180662
age -0.579267 0.348746 0.370164 0.413733 0.306564 -0.288137 -0.180662 1.000000
In [27]:
#Visual representation of above correlation 
plt.figure(figsize = (10,5))
sns.heatmap(Automobile.corr(), annot = True)
# From below we can infer that a car's Milage will reduce when numebr of cylinders, displacement ,
# horsepower and weight of the vechical increases
#however positive correlation among year and origin needs to be we understood
Out[27]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a307a61cd0>
In [28]:
#If the objective of our project was just to cluster the data, we might prefer fixing outliers with below 

#Take logaritmic transform for Milage, horsepower and acceleration to remove outliers so that 
# impact on centroids can be minimized, but since we need to build model removing outlier might lead to information loss

#Automobile['hp'] = np.log(Automobile['hp'])
#Automobile['acc'] = np.log(Automobile['acc'])
#Automobile['mpg'] = np.log(Automobile['mpg'])

#Automobile.describe().T

Machine learning:

• Use K Means and Hierarchical clustering to find out the optimal number of clusters in the data.
• Share your insights about the difference in using these two methods.

Creating cluster based on K means technique

In [29]:
#Before we start creating clusters, lets scale the data
Automobile_sc = Automobile.apply(zscore)
Automobile_sc.head()
Out[29]:
mpg cyl disp hp wt acc origin age
0 -0.706439 1.498191 1.090604 0.673118 0.630870 -1.295498 -0.715145 1.627426
1 -1.090751 1.498191 1.503514 1.589958 0.854333 -1.477038 -0.715145 1.627426
2 -0.706439 1.498191 1.196232 1.197027 0.550470 -1.658577 -0.715145 1.627426
3 -0.962647 1.498191 1.061796 1.197027 0.546923 -1.295498 -0.715145 1.627426
4 -0.834543 1.498191 1.042591 0.935072 0.565841 -1.840117 -0.715145 1.627426
In [30]:
# Variables are now scaled. Let us now try to create clusters
#import library for K means
from sklearn.cluster import KMeans 
from sklearn.metrics import silhouette_samples, silhouette_score

cluster_errors = []
silhouette_value = []
for i in range(1,10):
    kmeans = KMeans(n_clusters = i)
    kmeans.fit(Automobile_sc)
    labels = kmeans.labels_
    cluster_errors.append(kmeans.inertia_)
    if i > 1:
        silhouette_value.append(silhouette_score(Automobile_sc,labels))
    else:
        silhouette_value.append(1)



kmean_df = pd.DataFrame({"Number of cluster": range(1,10), "Cluster Iniertia": cluster_errors, "Silhouette score": silhouette_value})
kmean_df


#From below  it is clearly visible that after CLuster 4 Silhouete score bounces back hence we can opt for 4 Clsuter
Out[30]:
Number of cluster Cluster Iniertia Silhouette score
0 1 3184.000000 1.000000
1 2 1588.592457 0.414892
2 3 1190.043653 0.324667
3 4 988.154191 0.310081
4 5 829.715787 0.332970
5 6 750.858271 0.335682
6 7 680.796515 0.294829
7 8 635.082984 0.292740
8 9 591.575831 0.274419
In [31]:
# Another way of finding ideal K value is using elbow method
plt.plot(range(1,10), cluster_errors, marker = "o")

# Following the elbow method, below representations we can see that 
#after 3 clusters we dont see big shift in the error level when moving gradually towards higher number of clusters. 
# after Looking at both the methods, we can consider K = 4 clusters as per above mentioned silhouette observation
Out[31]:
[<matplotlib.lines.Line2D at 0x1a30ae71910>]

Creating CLuster based on hirarchical clustering technique

In [32]:
# Lets find which linkage method we can choose for using HIrarchical clustering for our given data set

from scipy.cluster.hierarchy import cophenet, linkage
from scipy.spatial.distance import pdist 

# cophenet index is a measure of the correlation between the distance of points in feature space
# closer it is to 1, the better is the clustering
# we will see for these linkage methods "single","complete","centroid","average","ward"

Z = linkage(Automobile_sc, metric='euclidean', method='single')
c, coph_dists = cophenet(Z , pdist(Automobile_sc))
print("Cophenetic correlation for given data set with Single linkage method is:" , c)

Z = linkage(Automobile_sc, metric='euclidean', method='complete')
c, coph_dists = cophenet(Z , pdist(Automobile_sc))
print("Cophenetic correlation for given data set with complete linkage method is:" , c)

Z = linkage(Automobile_sc, metric='euclidean', method='average')
c, coph_dists = cophenet(Z , pdist(Automobile_sc))
print("Cophenetic correlation for given data set with average linkage method is:" , c)

Z = linkage(Automobile_sc, metric='euclidean', method='ward')
c, coph_dists = cophenet(Z , pdist(Automobile_sc))
print("Cophenetic correlation for given data set with ward linkage method is:" , c)
Cophenetic correlation for given data set with Single linkage method is: 0.5581756271482968
Cophenetic correlation for given data set with complete linkage method is: 0.723784736927783
Cophenetic correlation for given data set with average linkage method is: 0.7554096381782244
Cophenetic correlation for given data set with ward linkage method is: 0.681505889742128
In [33]:
#Based on above, we can see that average linkage method gives the better results hence we can go for that method
In [34]:
# Importing necesary library 
from sklearn.cluster import AgglomerativeClustering 
HC_errors = []

for i in range (1,10):
    HCmodel = AgglomerativeClustering(n_clusters=i, affinity='euclidean',  linkage='complete')
    HCmodel.fit(Automobile_sc)
    labels = HCmodel.labels_
    if i > 1:
        HC_errors.append(silhouette_score(Automobile_sc,labels))
    else:
        HC_errors.append(1)
    
print("Silhouette coefficient for Hirarchical clustering technique with cluster 1 to 10 is: \n")
HC_errors
#From below  it is clearly visible that after CLuster 5 Silhouete score bounces back  and increases
#hence we can opt for 5 Clsuter based on Silhouette score
Silhouette coefficient for Hirarchical clustering technique with cluster 1 to 10 is: 

Out[34]:
[1,
 0.43968084062736096,
 0.26177521523453273,
 0.1932747725335333,
 0.18928061333444235,
 0.2146451164413301,
 0.2199570632773293,
 0.23211860697140704,
 0.20182701481898288]

Insights:

By using both K mean and Hirarchical clustering methods, it is a challenge to determine the correct number of clusters we will requrie for the data set.
As per the visual representation (spikes in pairplot )3 clsuters is what we inferred but then with K mean silhouette coefficients, 4 clusters will be the optimal number of clusters
With Hirarchical clustering technique its either by just looking at Dendogram for deciding the number of clusters or by silhouette coefficients results, in our case 5 clusters.

For this data, lets go ahead with K mean clusters and make individual cluster inferences

5. Answer below questions based on outcomes of using ML based methods.

• Mention how many optimal clusters are present in the data and what could be the possible reason behind it.
• Use linear regression model on different clusters separately and print the coefficients of the models individually
• How using different models for different clusters will be helpful in this case and how it will be different than using one single model without
clustering? Mention how it impacts performance and prediction.

In [35]:
# Based on above inference lets create kmean with 4 clusters
kmeans = KMeans(n_clusters = 4)
kmeans.fit(Automobile_sc)
labels = kmeans.labels_
In [36]:
#Adding the labels into our orginal data set
Automobile['Cluster4'] = labels
Automobile.head()
Out[36]:
mpg cyl disp hp wt acc origin age Cluster4
0 18.0 8 307.0 130.0 3504 12.0 1 13 1
1 15.0 8 350.0 165.0 3693 11.5 1 13 1
2 18.0 8 318.0 150.0 3436 11.0 1 13 1
3 16.0 8 304.0 150.0 3433 12.0 1 13 1
4 17.0 8 302.0 140.0 3449 10.5 1 13 1
In [37]:
#Lets check the individual group wise average values for each feature
temp_Automobile = Automobile.groupby(['Cluster4'])
print("Total data in each cluster")
temp_Automobile.count()
#Data in each clsuter is fairly distributed
Total data in each cluster
Out[37]:
mpg cyl disp hp wt acc origin age
Cluster4
0 99 99 99 99 99 99 99 99
1 95 95 95 95 95 95 95 95
2 94 94 94 94 94 94 94 94
3 110 110 110 110 110 110 110 110
In [38]:
print("Average data in each cluster")
temp_Automobile.mean()
Average data in each cluster
Out[38]:
mpg cyl disp hp wt acc origin age
Cluster4
0 25.049495 4.040404 107.974747 83.510101 2325.656566 16.418182 2.101010 9.373737
1 14.469474 8.000000 349.705263 162.105263 4154.526316 12.604211 1.000000 9.473684
2 19.937234 5.968085 221.212766 100.686170 3228.702128 16.585106 1.042553 6.808511
3 33.001818 4.090909 111.618182 76.190909 2307.372727 16.493636 2.045455 2.854545

WE can see that all the clusters are very close to each other based on
Cluster 2(mpg 19): car with average age, cylinders, horsepower gives moderate milage
Cluster 1(mpg 14): with more number of cylinders we can see that Milage is reduced
Cluster 3(mpg 33): New car gives more milage then older ones
Cluster 0(mpg 25): with reduced weight and cylinders even if the Car's age is more, we can expect the milage to be pretty good at around 25 mpg
Also we can infer that Origin from base 2 tend to give more milage then Origin 1 cars

In [39]:
#Adding the labels into our orginal data set
Automobile_sc['Cluster4'] = labels
Automobile_sc.head()
Out[39]:
mpg cyl disp hp wt acc origin age Cluster4
0 -0.706439 1.498191 1.090604 0.673118 0.630870 -1.295498 -0.715145 1.627426 1
1 -1.090751 1.498191 1.503514 1.589958 0.854333 -1.477038 -0.715145 1.627426 1
2 -0.706439 1.498191 1.196232 1.197027 0.550470 -1.658577 -0.715145 1.627426 1
3 -0.962647 1.498191 1.061796 1.197027 0.546923 -1.295498 -0.715145 1.627426 1
4 -0.834543 1.498191 1.042591 0.935072 0.565841 -1.840117 -0.715145 1.627426 1
In [40]:
plt.scatter(Automobile_sc['Cluster4'],Automobile_sc['mpg'], color = ['Lightgreen'])
#We can observe that all the clusters overlap each other to considerable extent,
# Hence it is justifis that it will be difficult for a model to perform with high accuracy
Out[40]:
<matplotlib.collections.PathCollection at 0x1a30ae842e0>
In [41]:
sns.catplot(x='mpg', y = 'mpg', data = Automobile_sc, hue = 'Cluster4')
#Anoter way of representing mpg data across all 4 clusters, we can see that cluster 2 iscomplete overlap under all three clusters
Out[41]:
<seaborn.axisgrid.FacetGrid at 0x1a30af02040>
In [42]:
#Creating model on original dataset
x_sc = Automobile_sc.drop('mpg', axis = 1)
y_sc = Automobile_sc['mpg']
x_train_sc, x_test_sc, y_train_sc, y_test_sc = train_test_split(x_sc, y_sc, test_size=0.30, random_state=1)
In [43]:
#creating Liner regression on entire dataset
from sklearn.linear_model import LinearRegression
LR_model_sc = LinearRegression()

LR_model_sc.fit(x_train_sc, y_train_sc)
print("Performance of Linear regression model on entire data set is:", LR_model_sc.score(x_test_sc,y_test_sc))
print("\nCoefficient of Linear regression model on entire data set is: \n", LR_model_sc.coef_)

# we can see that wihtout tuning our model is able to perform with accuracy of 86%, 
# now lets find how model performs on individual clusters
Performance of Linear regression model on entire data set is: 0.8696863505908773

Coefficient of Linear regression model on entire data set is: 
 [-0.09032185  0.18211267 -0.01053332 -0.7239545   0.03790639  0.13874186
 -0.22781842  0.17718197]
In [44]:
#Create different data set based on clusters to run liner regresison on each data set
cl0 = Automobile_sc.loc[Automobile_sc['Cluster4']== 0]
cl1 = Automobile_sc.loc[Automobile_sc['Cluster4']== 1]
cl2 = Automobile_sc.loc[Automobile_sc['Cluster4']== 2]
cl3 = Automobile_sc.loc[Automobile_sc['Cluster4']== 3]
In [45]:
#Create x and y data set for each cluster data

Xcl0 =cl0.drop(['mpg'], axis=1)
ycl0 = cl0[['mpg']]

Xcl1 =cl1.drop(['mpg'], axis=1)
ycl1 = cl1[['mpg']]

Xcl2 =cl2.drop(['mpg'], axis=1)
ycl2 = cl2[['mpg']]

Xcl3 =cl3.drop(['mpg'], axis=1)
ycl3 = cl3[['mpg']]
In [46]:
#Create training and testing data set for each cluster with 70:30 ratio
X_train_cl0, X_test_cl0, y_train_cl0, y_test_cl0 = train_test_split(Xcl0, ycl0, test_size=0.30, random_state=1)
X_train_cl1, X_test_cl1, y_train_cl1, y_test_cl1 = train_test_split(Xcl1, ycl1, test_size=0.30, random_state=1)
X_train_cl2, X_test_cl2, y_train_cl2, y_test_cl2 = train_test_split(Xcl2, ycl2, test_size=0.30, random_state=1)
X_train_cl3, X_test_cl3, y_train_cl3, y_test_cl3 = train_test_split(Xcl3, ycl3, test_size=0.30, random_state=1)
In [47]:
#creating Liner regression on each cluster
from sklearn.linear_model import LinearRegression

LR_model_cl0 = LinearRegression()
LR_model_cl1 = LinearRegression()
LR_model_cl2 = LinearRegression()
LR_model_cl3 = LinearRegression()

LR_model_cl0.fit(X_train_cl0, y_train_cl0)
print("\Performance of Linear regression model on cluster 0 is:", LR_model_cl0.score(X_test_cl0,y_test_cl0))
print("\nCoefficient of Linear regression model on cluster 0 is: \n", LR_model_cl0.coef_)
\Performance of Linear regression model on cluster 0 is: 0.6822006536408214

Coefficient of Linear regression model on cluster 0 is: 
 [[ 0.31280444 -0.27960158 -0.45011516 -0.55717623 -0.113109    0.02258894
  -0.05754112  0.        ]]
In [48]:
LR_model_cl1.fit(X_train_cl1, y_train_cl1)
print("\Performance of Linear regression model on cluster 0 is:", LR_model_cl1.score(X_test_cl1,y_test_cl1))
print("\nCoefficient of Linear regression model on cluster 1 is: \n", LR_model_cl1.coef_)
\Performance of Linear regression model on cluster 0 is: 0.39057409427748435

Coefficient of Linear regression model on cluster 1 is: 
 [[-1.14916755e+11  2.75854716e-02 -1.58169608e-01 -1.66760462e-01
  -1.52875649e-01  2.87706251e+10 -1.64182441e-01  0.00000000e+00]]
In [49]:
LR_model_cl2.fit(X_train_cl2, y_train_cl2)
print("\Performance of Linear regression model on cluster 0 is:", LR_model_cl2.score(X_test_cl2,y_test_cl2))
print("\nCoefficient of Linear regression model on cluster 2 is: \n", LR_model_cl2.coef_)
\Performance of Linear regression model on cluster 0 is: -0.29255434433900374

Coefficient of Linear regression model on cluster 2 is: 
 [[ 0.09596191 -0.36076751  0.24019658 -0.40566465 -0.01596469 -0.54765141
  -0.20763181  0.        ]]
In [50]:
LR_model_cl3.fit(X_train_cl3, y_train_cl3)
print("\Performance of Linear regression model on cluster 0 is:", LR_model_cl3.score(X_test_cl3,y_test_cl3))
print("\nCoefficient of Linear regression model on cluster 3 is: \n", LR_model_cl3.coef_)
\Performance of Linear regression model on cluster 0 is: 0.4850718791801967

Coefficient of Linear regression model on cluster 3 is: 
 [[ 0.28766827  0.4985276  -0.34361327 -1.05717264  0.15869053  0.0533829
  -0.37980969  0.        ]]

From Above we can see that model performance is different for different clusters which can be fine tuned further for better model performance by using different models for different clusters.

So when the new observation of the car comes in, we can identify which cluster it belongs to and then accordignly realize what will be its probable average milage per galon. In this particular data set after observing model's performances, we can go for complete data set to create the model rather than first clustering and then builing model on same.

CLustring the data can be opted in case we have too large data set and have clusters which are well separable, eventually resulting in better models for predicting target variables.

For better analysis in future, company can update the features like year to age incase of descrete varaibles, if possible standard format of one hot encoding should be followed for better model performances

Part 2

DOMAIN: Manufacturing

PROJECT OBJECTIVE: Goal is to build a synthetic data generation model using the existing data provided by the company.

Solution approach: In order to find data for target column, we can use a machine learning model which can read the pattern among the existing complete data and accordingly generate the synthetic data for remaining incomplete data.

import libraries that will be used for EDA

import pandas as pd import warnings warnings.filterwarnings('ignore') pd.set_option('display.max_rows', None)

In [51]:
#Import data and take the first look at the data
data = pd.read_excel('Part2 - Company.xlsx')
data.head()
Out[51]:
A B C D Quality
0 47 27 45 108 Quality A
1 174 133 134 166 Quality B
2 159 163 135 131 NaN
3 61 23 3 44 Quality A
4 59 60 9 68 Quality A
In [52]:
#Check the shape of the data
data.shape
Out[52]:
(61, 5)
In [53]:
#We can see that we have null values only in Quality field
data.isnull().any()
Out[53]:
A          False
B          False
C          False
D          False
Quality     True
dtype: bool
In [54]:
# We have total of 18 columns with null values
data['Quality'].isnull().sum()
Out[54]:
18

Lets generate the model based on available data and generate synthetic data for missing values under Quality column

In [55]:
#Saperating data with complete and incomplete values
incomplete_data = data[data['Quality'].isnull() == True]
complete_data = data[data['Quality'].isnull() == False]
In [56]:
#Check the index positions of missing values
incomplete_data.index
Out[56]:
Int64Index([2, 5, 7, 9, 14, 18, 23, 27, 29, 32, 35, 40, 46, 52, 57, 58, 59,
            60],
           dtype='int64')
In [57]:
#Check the index positions of complete data
complete_data.index
Out[57]:
Int64Index([ 0,  1,  3,  4,  6,  8, 10, 11, 12, 13, 15, 16, 17, 19, 20, 21, 22,
            24, 25, 26, 28, 30, 31, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45,
            47, 48, 49, 50, 51, 53, 54, 55, 56],
           dtype='int64')
In [58]:
# Split Xdrop and y into training and test set  based on available data
x_train = complete_data.drop('Quality', axis = 1)
y_train = complete_data['Quality']
x_test = incomplete_data.drop('Quality', axis = 1)
y_test = incomplete_data['Quality']
In [59]:
# Creating logistic Regresison model to generate predict missing values of Quality
from sklearn.linear_model import LogisticRegression
model = LogisticRegression()
model.fit(x_train, y_train)
y_predict = model.predict(x_test)
print("Synthetic data generated for incomplete data is\n", y_predict)
Synthetic data generated for incomplete data is
 ['Quality B' 'Quality B' 'Quality B' 'Quality B' 'Quality B' 'Quality B'
 'Quality B' 'Quality B' 'Quality A' 'Quality B' 'Quality B' 'Quality B'
 'Quality B' 'Quality B' 'Quality B' 'Quality A' 'Quality B' 'Quality B']
In [60]:
# Now that we have Synthetic data generated for missing values, lets complete the data by filling in missing values
pd.set_option('display.max_rows', None)
incomplete_data['Quality'] = y_predict
Newdata = incomplete_data.append(complete_data)
Newdata.sort_index()
Out[60]:
A B C D Quality
0 47 27 45 108 Quality A
1 174 133 134 166 Quality B
2 159 163 135 131 Quality B
3 61 23 3 44 Quality A
4 59 60 9 68 Quality A
5 153 140 154 199 Quality B
6 34 28 78 22 Quality A
7 191 144 143 154 Quality B
8 160 181 194 178 Quality B
9 145 178 158 141 Quality B
10 76 94 107 37 Quality A
11 138 200 153 192 Quality B
12 27 106 57 37 Quality A
13 45 76 56 57 Quality A
14 186 142 146 174 Quality B
15 196 145 166 132 Quality B
16 4 61 72 98 Quality A
17 96 109 75 34 Quality A
18 167 171 163 191 Quality B
19 196 178 165 177 Quality B
20 159 181 142 166 Quality B
21 5 100 32 110 Quality A
22 3 63 109 67 Quality A
23 171 185 181 183 Quality B
24 101 104 95 49 Quality A
25 103 74 59 17 Quality A
26 170 153 181 176 Quality B
27 193 169 199 155 Quality B
28 85 58 44 32 Quality A
29 29 49 6 35 Quality A
30 135 163 194 168 Quality B
31 142 159 176 150 Quality B
32 161 138 143 139 Quality B
33 170 174 190 181 Quality B
34 183 142 164 186 Quality B
35 181 147 174 130 Quality B
36 185 168 160 151 Quality B
37 132 157 174 138 Quality B
38 44 104 8 21 Quality A
39 102 5 59 72 Quality A
40 179 143 189 177 Quality B
41 73 22 83 31 Quality A
42 48 68 98 51 Quality A
43 169 184 200 133 Quality B
44 22 9 25 76 Quality A
45 44 90 6 8 Quality A
46 197 173 165 197 Quality B
47 28 91 17 17 Quality A
48 197 161 182 198 Quality B
49 136 199 189 141 Quality B
50 47 44 66 41 Quality A
51 110 33 76 3 Quality A
52 188 178 175 162 Quality B
53 91 13 14 88 Quality A
54 70 96 70 103 Quality A
55 103 60 15 56 Quality A
56 200 186 185 179 Quality B
57 137 182 165 199 Quality B
58 88 39 9 102 Quality A
59 180 157 192 198 Quality B
60 157 135 135 156 Quality B
In [61]:
#Lets confirm themissing values again
Newdata['Quality'].isnull().sum()
Out[61]:
0

Part 3

DOMAIN: Automobile

CONTEXT: The purpose is to classify a given silhouette as one of three types of vehicle, using a set of features extracted from the silhouette. The vehicle may be viewed from one of many different angles.'

PROJECT OBJECTIVE: Apply dimensionality reduction technique – PCA and train a model using principal components instead of training the model using just the raw data.

import libraries that will be used for EDA

import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline from scipy.stats import zscore from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn import preprocessing from sklearn.metrics import average_precision_score, confusion_matrix, accuracy_score, classification_report, plot_confusion_matrix import warnings warnings.filterwarnings('ignore')

In [62]:
#Load tha data set and take the fist glance at the data
cars = pd.read_csv('Part3 - vehicle.csv')
cars.head()
Out[62]:
compactness circularity distance_circularity radius_ratio pr.axis_aspect_ratio max.length_aspect_ratio scatter_ratio elongatedness pr.axis_rectangularity max.length_rectangularity scaled_variance scaled_variance.1 scaled_radius_of_gyration scaled_radius_of_gyration.1 skewness_about skewness_about.1 skewness_about.2 hollows_ratio class
0 95 48.0 83.0 178.0 72.0 10 162.0 42.0 20.0 159 176.0 379.0 184.0 70.0 6.0 16.0 187.0 197 van
1 91 41.0 84.0 141.0 57.0 9 149.0 45.0 19.0 143 170.0 330.0 158.0 72.0 9.0 14.0 189.0 199 van
2 104 50.0 106.0 209.0 66.0 10 207.0 32.0 23.0 158 223.0 635.0 220.0 73.0 14.0 9.0 188.0 196 car
3 93 41.0 82.0 159.0 63.0 9 144.0 46.0 19.0 143 160.0 309.0 127.0 63.0 6.0 10.0 199.0 207 van
4 85 44.0 70.0 205.0 103.0 52 149.0 45.0 19.0 144 241.0 325.0 188.0 127.0 9.0 11.0 180.0 183 bus
In [63]:
#CHeck the shape of the data
cars.shape
# we have 846 obsrvations with 19 differnet features of cars/van/bus
Out[63]:
(846, 19)
In [64]:
cars.info()
#We can see that there are may feature with null values however all the columns are numeic except for target columns
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 846 entries, 0 to 845
Data columns (total 19 columns):
 #   Column                       Non-Null Count  Dtype  
---  ------                       --------------  -----  
 0   compactness                  846 non-null    int64  
 1   circularity                  841 non-null    float64
 2   distance_circularity         842 non-null    float64
 3   radius_ratio                 840 non-null    float64
 4   pr.axis_aspect_ratio         844 non-null    float64
 5   max.length_aspect_ratio      846 non-null    int64  
 6   scatter_ratio                845 non-null    float64
 7   elongatedness                845 non-null    float64
 8   pr.axis_rectangularity       843 non-null    float64
 9   max.length_rectangularity    846 non-null    int64  
 10  scaled_variance              843 non-null    float64
 11  scaled_variance.1            844 non-null    float64
 12  scaled_radius_of_gyration    844 non-null    float64
 13  scaled_radius_of_gyration.1  842 non-null    float64
 14  skewness_about               840 non-null    float64
 15  skewness_about.1             845 non-null    float64
 16  skewness_about.2             845 non-null    float64
 17  hollows_ratio                846 non-null    int64  
 18  class                        846 non-null    object 
dtypes: float64(14), int64(4), object(1)
memory usage: 125.7+ KB
In [65]:
cars.isnull().sum()
# we can see below are the features with missing values
Out[65]:
compactness                    0
circularity                    5
distance_circularity           4
radius_ratio                   6
pr.axis_aspect_ratio           2
max.length_aspect_ratio        0
scatter_ratio                  1
elongatedness                  1
pr.axis_rectangularity         3
max.length_rectangularity      0
scaled_variance                3
scaled_variance.1              2
scaled_radius_of_gyration      2
scaled_radius_of_gyration.1    4
skewness_about                 6
skewness_about.1               1
skewness_about.2               1
hollows_ratio                  0
class                          0
dtype: int64
In [66]:
#Bfore fixing the null values lets check 5 point summary of te data
cars.describe().T
#we can observe that mean value of almost all the features is near aound at 50% of the data
# so we can say that data is good and we can use Mean value of each feature to be rplaces with null values
# Also, sicne we have all the columns, we dont have any '?' values in the dataset 
Out[66]:
count mean std min 25% 50% 75% max
compactness 846.0 93.678487 8.234474 73.0 87.00 93.0 100.0 119.0
circularity 841.0 44.828775 6.152172 33.0 40.00 44.0 49.0 59.0
distance_circularity 842.0 82.110451 15.778292 40.0 70.00 80.0 98.0 112.0
radius_ratio 840.0 168.888095 33.520198 104.0 141.00 167.0 195.0 333.0
pr.axis_aspect_ratio 844.0 61.678910 7.891463 47.0 57.00 61.0 65.0 138.0
max.length_aspect_ratio 846.0 8.567376 4.601217 2.0 7.00 8.0 10.0 55.0
scatter_ratio 845.0 168.901775 33.214848 112.0 147.00 157.0 198.0 265.0
elongatedness 845.0 40.933728 7.816186 26.0 33.00 43.0 46.0 61.0
pr.axis_rectangularity 843.0 20.582444 2.592933 17.0 19.00 20.0 23.0 29.0
max.length_rectangularity 846.0 147.998818 14.515652 118.0 137.00 146.0 159.0 188.0
scaled_variance 843.0 188.631079 31.411004 130.0 167.00 179.0 217.0 320.0
scaled_variance.1 844.0 439.494076 176.666903 184.0 318.00 363.5 587.0 1018.0
scaled_radius_of_gyration 844.0 174.709716 32.584808 109.0 149.00 173.5 198.0 268.0
scaled_radius_of_gyration.1 842.0 72.447743 7.486190 59.0 67.00 71.5 75.0 135.0
skewness_about 840.0 6.364286 4.920649 0.0 2.00 6.0 9.0 22.0
skewness_about.1 845.0 12.602367 8.936081 0.0 5.00 11.0 19.0 41.0
skewness_about.2 845.0 188.919527 6.155809 176.0 184.00 188.0 193.0 206.0
hollows_ratio 846.0 195.632388 7.438797 181.0 190.25 197.0 201.0 211.0
In [67]:
#Lets fix the null values first before proceeding further
#Replace blank valus with Nan values
cars = cars.replace('', np.nan)

#Replace the Null value with the mean value of each column
for i in cars.columns[:17]:
    mean = cars[i].mean()
    cars[i] = cars[i].fillna(mean)
In [68]:
#Lets confirm if we have any null values in the data anymore
cars.isnull().sum()
Out[68]:
compactness                    0
circularity                    0
distance_circularity           0
radius_ratio                   0
pr.axis_aspect_ratio           0
max.length_aspect_ratio        0
scatter_ratio                  0
elongatedness                  0
pr.axis_rectangularity         0
max.length_rectangularity      0
scaled_variance                0
scaled_variance.1              0
scaled_radius_of_gyration      0
scaled_radius_of_gyration.1    0
skewness_about                 0
skewness_about.1               0
skewness_about.2               0
hollows_ratio                  0
class                          0
dtype: int64
In [69]:
#Lets check the class wise distribution of the data
cars['class'].value_counts()
Out[69]:
car    429
bus    218
van    199
Name: class, dtype: int64
In [70]:
#Lets check the distribution of each feature
cars.hist(color='lightblue', edgecolor = 'black', alpha = 0.7, figsize = (15,20), layout=(6,3))
plt.tight_layout()
plt.show()
#we can see that distribution is quite normal for all columns except for Max.length_aspect_ratio, pr.axis_aspect_ratio,
#scaled_radious_of_gyrathon, pr.axis_rectangularity, skewness_about, skewness_about.1
In [71]:
# For Skewness, closer the value to 0, perfectly the distribution follows normal distribution
#negative skew: The left tail is longer; the mass of the distribution is concentrated on the right of the figure.
#positive skew: The right tail is longer; the mass of the distribution is concentrated on the left of the figure. 
cars.skew()

#From below we can clearly see that pr.axis_aspect_ratio,max.length_aspect_ratio and scaled_radius_of_gyration.1    
#are highly skewed data and distribution for other features is quite acceptale
Out[71]:
compactness                    0.381271
circularity                    0.262584
distance_circularity           0.106837
radius_ratio                   0.396381
pr.axis_aspect_ratio           3.834882
max.length_aspect_ratio        6.778394
scatter_ratio                  0.607629
elongatedness                  0.047875
pr.axis_rectangularity         0.772254
max.length_rectangularity      0.256359
scaled_variance                0.652753
scaled_variance.1              0.843027
scaled_radius_of_gyration      0.279647
scaled_radius_of_gyration.1    2.088422
skewness_about                 0.779277
skewness_about.1               0.688423
skewness_about.2               0.249468
hollows_ratio                 -0.226341
dtype: float64
In [72]:
#Lets check for the outliers in teh dataset
for columns in cars.columns[:17]:
    plt.figure()
    plt.title(columns)
    sns.boxplot(data = cars[columns], orient="h" , color = 'pink')
    
# we can see that we have outliers in radius_ratio, pr.axis_aspect_ratio, max.length_aspect_ratio, scaled_variance, 
# scaled_variance1, scaled_radius_of_gyration.1 , skweness_about

# Treating ouliers is really a big decision as it might caus information loss in case of data sets with large no of outliers

#SVM is not very robust to outliers and hence presence of a few outliers can lead to misclassification.
#Hence we choose to get rid of outliers
In [73]:
# For all the columns find the 1st and 3rd quartlie value
# Then calculate cutoff value for each column based on 1st and 3rd quartlie value
# Replace the outliers with median values

for columns in cars.columns[:17]:
    #find 1st and 3rd quartile
    q1 = cars[columns].quantile(0.25)
    q3 = cars[columns].quantile(0.75)
    iqr = q3 -q1
    
    #outlier cutoff
    low = q1-1.5*iqr
    high = q3+1.5*iqr
    
    #replace oulier with median of each column
    cars.loc[(cars[columns] < low) | (cars[columns] > high), columns] = cars[columns].median()
In [74]:
#Lets check for the outliers in the dataset again
for columns in cars.columns[:17]:
    plt.figure()
    plt.title(columns)
    sns.boxplot(data = cars[columns], orient="h" , color = 'pink')

# we can observe that we dont have nay outlier in the data set
In [75]:
# Lets check the pairplot to see the individual distribution on diagonal plots 
# and correlation  of all columns among each other on either sides of diagonal plots

sns.pairplot(cars, hue = 'class')
plt.legend = True
plt.show
# Checking the correlation using pairplot, we can observe many positive slope and few negative slope
# that means many features are positively correlated with each other, meaning if one grows other gorws as well.
# We can also observe Distribution of each class on diagonol distribution under each feature
#(Blue - Van, Orange - car, green - bus)
#SInce the Class data is not linearly separable we can not have and Hard margin when we think of SVM
Out[75]:
<function matplotlib.pyplot.show(*args, **kw)>
In [76]:
#for correlation, closer the value to 1, higher is the corelation betwen two features
cars.corr()
# we can observer clear correlation between each feature, lets visualize usign heatmap and then summarize our observation
Out[76]:
compactness circularity distance_circularity radius_ratio pr.axis_aspect_ratio max.length_aspect_ratio scatter_ratio elongatedness pr.axis_rectangularity max.length_rectangularity scaled_variance scaled_variance.1 scaled_radius_of_gyration scaled_radius_of_gyration.1 skewness_about skewness_about.1 skewness_about.2 hollows_ratio
compactness 1.000000 0.685421 0.789909 0.721988 0.193100 0.499928 0.812235 -0.788643 0.813636 0.676143 0.770575 0.808092 0.585156 -0.248242 0.196883 0.156722 0.298526 0.365552
circularity 0.685421 1.000000 0.793016 0.638393 0.202738 0.560067 0.848207 -0.821901 0.844972 0.961943 0.803291 0.830089 0.926888 0.069350 0.136594 -0.010078 -0.105645 0.045318
distance_circularity 0.789909 0.793016 1.000000 0.794294 0.244306 0.666647 0.904400 -0.911435 0.893128 0.774669 0.870051 0.885282 0.705953 -0.230187 0.099014 0.262354 0.145563 0.332095
radius_ratio 0.721988 0.638393 0.794294 1.000000 0.650738 0.463999 0.769693 -0.825686 0.743994 0.579807 0.786985 0.762029 0.550987 -0.390628 0.035738 0.179702 0.405705 0.491694
pr.axis_aspect_ratio 0.193100 0.202738 0.244306 0.650738 1.000000 0.150277 0.194212 -0.298492 0.162831 0.147896 0.207884 0.197112 0.148793 -0.321697 -0.056127 -0.021289 0.400841 0.415725
max.length_aspect_ratio 0.499928 0.560067 0.666647 0.463999 0.150277 1.000000 0.490360 -0.504032 0.488316 0.642713 0.401572 0.464533 0.397329 -0.336639 0.081637 0.141861 0.083613 0.413174
scatter_ratio 0.812235 0.848207 0.904400 0.769693 0.194212 0.490360 1.000000 -0.970723 0.989370 0.808356 0.960513 0.981244 0.799266 0.010024 0.064098 0.212351 0.005167 0.118448
elongatedness -0.788643 -0.821901 -0.911435 -0.825686 -0.298492 -0.504032 -0.970723 1.000000 -0.949077 -0.775519 -0.947980 -0.950135 -0.766029 0.079526 -0.046310 -0.184284 -0.114727 -0.216719
pr.axis_rectangularity 0.813636 0.844972 0.893128 0.743994 0.162831 0.488316 0.989370 -0.949077 1.000000 0.811447 0.947676 0.974917 0.797068 0.026627 0.072310 0.213838 -0.018990 0.099191
max.length_rectangularity 0.676143 0.961943 0.774669 0.579807 0.147896 0.642713 0.808356 -0.775519 0.811447 1.000000 0.750446 0.791060 0.866425 0.053131 0.130585 0.004423 -0.104254 0.076770
scaled_variance 0.770575 0.803291 0.870051 0.786985 0.207884 0.401572 0.960513 -0.947980 0.947676 0.750446 1.000000 0.945178 0.785130 0.025510 0.023960 0.198165 0.015373 0.087238
scaled_variance.1 0.808092 0.830089 0.885282 0.762029 0.197112 0.464533 0.981244 -0.950135 0.974917 0.791060 0.945178 1.000000 0.784051 0.007260 0.065883 0.205722 0.017976 0.120470
scaled_radius_of_gyration 0.585156 0.926888 0.705953 0.550987 0.148793 0.397329 0.799266 -0.766029 0.797068 0.866425 0.785130 0.784051 1.000000 0.215398 0.162850 -0.055486 -0.224866 -0.118157
scaled_radius_of_gyration.1 -0.248242 0.069350 -0.230187 -0.390628 -0.321697 -0.336639 0.010024 0.079526 0.026627 0.053131 0.025510 0.007260 0.215398 1.000000 -0.057945 -0.124687 -0.835003 -0.903402
skewness_about 0.196883 0.136594 0.099014 0.035738 -0.056127 0.081637 0.064098 -0.046310 0.072310 0.130585 0.023960 0.065883 0.162850 -0.057945 1.000000 -0.041756 0.086502 0.062342
skewness_about.1 0.156722 -0.010078 0.262354 0.179702 -0.021289 0.141861 0.212351 -0.184284 0.213838 0.004423 0.198165 0.205722 -0.055486 -0.124687 -0.041756 1.000000 0.074591 0.200752
skewness_about.2 0.298526 -0.105645 0.145563 0.405705 0.400841 0.083613 0.005167 -0.114727 -0.018990 -0.104254 0.015373 0.017976 -0.224866 -0.835003 0.086502 0.074591 1.000000 0.892840
hollows_ratio 0.365552 0.045318 0.332095 0.491694 0.415725 0.413174 0.118448 -0.216719 0.099191 0.076770 0.087238 0.120470 -0.118157 -0.903402 0.062342 0.200752 0.892840 1.000000
In [77]:
#Visualize the above correlation using heat map
plt.figure(figsize = (20,18))
sns.heatmap(cars.corr(), annot = True)
Out[77]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a318e8f9a0>

WE can see that there is heavy correlation between many features. like
circularity is highly correlated with max.length_rectangularity, scaled_radius_of_gyration
distance_circularity with scatter_ratio, axis_rectangularity,scaled_variance,scaled_variance1
Scatter_ratio with axis_rectangularity,scaled_variance, scaled_variance1
elongatedness is negatively correlated with most of the features
pr.axis_rectangularity with scaled_variance, scaled_variance.1,
scaled_variance with scaled_variance.1 and skewness_about.2 with hollows_ratio

So for the classification models, more the linearly correlated features more difficult it becomes to make accurate predictions hence if two features are highly correlated then there is no point using both features we can drop any one feature out of two.

Since we have many very highly colinear feature we might need to reduce the columns

Split the data into training and testing data set

In [78]:
x  = cars.drop(['class'] , axis = 1)
y = cars['class']

# Scaling the data set using standardScaler
from sklearn.preprocessing import StandardScaler

x_sc = StandardScaler().fit_transform(x)
In [79]:
x_train, x_test, y_train, y_test = train_test_split(x_sc,y,test_size=0.30, random_state=1)

Lets create SVM model wthout reducing dimensions

In [80]:
# Import necessary libraries
from sklearn.svm import SVC

# Building a Support Vector Machine on train data
svc_model = SVC(C= .1, kernel='linear', gamma= 1)
svc_model.fit(x_train, y_train)

y_pred = svc_model.predict(x_test)
print ('Accuracy of SVC model without reducing any dimensions is:', accuracy_score(y_test, y_pred)*100 )
print ('classification report of this model is:' )
print(metrics.classification_report(y_test, y_pred))
Accuracy of SVC model without reducing any dimensions is: 90.94488188976378
classification report of this model is:
              precision    recall  f1-score   support

         bus       0.87      0.90      0.88        59
         car       0.92      0.92      0.92       133
         van       0.92      0.89      0.90        62

    accuracy                           0.91       254
   macro avg       0.90      0.90      0.90       254
weighted avg       0.91      0.91      0.91       254

In [81]:
plot_confusion_matrix(svc_model,x_test,y_test)
Out[81]:
<sklearn.metrics._plot.confusion_matrix.ConfusionMatrixDisplay at 0x1a3190539a0>
In [82]:
# we can see that without reducing dimensions the model accuracy is 90.94% 
#under which it successfully predicted 88%, 92% and 90% correct bus,car and van silhouette respectively.
# For Bus: Model correctly predicted 53 observations as bus, and incorrectly predicted 5 cars and 1 van
# For Car: Model correctly predicted 123 observations as car, and incorrectly predicted 6 bus and 5 van
# For Van: Model correctly predicted 55 observations as van, and incorrectly predicted 2 bus and 5 car

Lets reduce the dimensions using PCA

We can reduce dimensions using PCA by following below steps:

  1. Calculate the covariance matrix.
  2. Calculate the eigenvectors and their eigenvalues.
  3. Sort the eigenvectors according to their eigenvalues in descending order.
  4. Choose the first K eigenvectors (where k is the dimension we'd like to end up with).
  5. Build new dataset with reduced dimensionality. (For this particular module lets try implementing PCA manually, in the next modules we can straight away use PCA.fit_transform funtion to reduce dimensions)
In [83]:
# Calculate the covariance matrix
cov_matrix = np.cov(x_sc.T)
print("cov_matrix shape:",cov_matrix.shape)
print("Covariance_matrix",cov_matrix)
cov_matrix shape: (18, 18)
Covariance_matrix [[ 1.00118343  0.68623251  0.79084412  0.72284195  0.19332811  0.50051942
   0.81319623 -0.78957587  0.81459888  0.67694334  0.77148742  0.80904814
   0.58584865 -0.24853609  0.19711609  0.15690754  0.2988797   0.36598446]
 [ 0.68623251  1.00118343  0.79395399  0.63914881  0.20297793  0.5607299
   0.84921058 -0.82287347  0.84597164  0.96308094  0.80424197  0.83107165
   0.92798524  0.06943233  0.13675532 -0.01009024 -0.1057698   0.04537164]
 [ 0.79084412  0.79395399  1.00118343  0.79523405  0.24459503  0.66743588
   0.90547061 -0.91251368  0.89418513  0.77558624  0.87108073  0.88632922
   0.70678835 -0.23045959  0.09913112  0.26266461  0.14573497  0.3324884 ]
 [ 0.72284195  0.63914881  0.79523405  1.00118343  0.65150778  0.46454839
   0.77060345 -0.8266636   0.74487406  0.58049352  0.78791632  0.76293107
   0.55163932 -0.39108991  0.03578066  0.17991457  0.40618509  0.49227551]
 [ 0.19332811  0.20297793  0.24459503  0.65150778  1.00118343  0.15045483
   0.19444163 -0.298845    0.16302363  0.14807109  0.20813046  0.19734493
   0.14896898 -0.322078   -0.05619315 -0.02131407  0.40131512  0.41621674]
 [ 0.50051942  0.5607299   0.66743588  0.46454839  0.15045483  1.00118343
   0.49094072 -0.50462865  0.48889422  0.64347365  0.40204727  0.46508322
   0.39779883 -0.33703781  0.08173397  0.14202875  0.08371214  0.41366325]
 [ 0.81319623  0.84921058  0.90547061  0.77060345  0.19444163  0.49094072
   1.00118343 -0.97187169  0.99054075  0.80931225  0.96165015  0.98240486
   0.80021174  0.01003596  0.06417406  0.21260233  0.00517279  0.11858838]
 [-0.78957587 -0.82287347 -0.91251368 -0.8266636  -0.298845   -0.50462865
  -0.97187169  1.00118343 -0.9502004  -0.77643696 -0.9491023  -0.95125937
  -0.76693543  0.07962014 -0.04636444 -0.18450233 -0.11486327 -0.21697531]
 [ 0.81459888  0.84597164  0.89418513  0.74487406  0.16302363  0.48889422
   0.99054075 -0.9502004   1.00118343  0.81240688  0.94879798  0.97607102
   0.79801083  0.02665869  0.0723955   0.21409091 -0.01901199  0.09930879]
 [ 0.67694334  0.96308094  0.77558624  0.58049352  0.14807109  0.64347365
   0.80931225 -0.77643696  0.81240688  1.00118343  0.75133454  0.79199646
   0.86744991  0.05319399  0.13073916  0.00442832 -0.10437712  0.07686047]
 [ 0.77148742  0.80424197  0.87108073  0.78791632  0.20813046  0.40204727
   0.96165015 -0.9491023   0.94879798  0.75133454  1.00118343  0.94629611
   0.78605894  0.02554037  0.02398808  0.19839916  0.01539144  0.08734151]
 [ 0.80904814  0.83107165  0.88632922  0.76293107  0.19734493  0.46508322
   0.98240486 -0.95125937  0.97607102  0.79199646  0.94629611  1.00118343
   0.78497867  0.00726815  0.06596118  0.20596564  0.01799681  0.1206127 ]
 [ 0.58584865  0.92798524  0.70678835  0.55163932  0.14896898  0.39779883
   0.80021174 -0.76693543  0.79801083  0.86744991  0.78605894  0.78497867
   1.00118343  0.21565325  0.16304287 -0.05555122 -0.22513165 -0.1182971 ]
 [-0.24853609  0.06943233 -0.23045959 -0.39108991 -0.322078   -0.33703781
   0.01003596  0.07962014  0.02665869  0.05319399  0.02554037  0.00726815
   0.21565325  1.00118343 -0.05801348 -0.12483496 -0.83599129 -0.9044713 ]
 [ 0.19711609  0.13675532  0.09913112  0.03578066 -0.05619315  0.08173397
   0.06417406 -0.04636444  0.0723955   0.13073916  0.02398808  0.06596118
   0.16304287 -0.05801348  1.00118343 -0.04180564  0.08660412  0.06241615]
 [ 0.15690754 -0.01009024  0.26266461  0.17991457 -0.02131407  0.14202875
   0.21260233 -0.18450233  0.21409091  0.00442832  0.19839916  0.20596564
  -0.05555122 -0.12483496 -0.04180564  1.00118343  0.07467975  0.20098946]
 [ 0.2988797  -0.1057698   0.14573497  0.40618509  0.40131512  0.08371214
   0.00517279 -0.11486327 -0.01901199 -0.10437712  0.01539144  0.01799681
  -0.22513165 -0.83599129  0.08660412  0.07467975  1.00118343  0.89389629]
 [ 0.36598446  0.04537164  0.3324884   0.49227551  0.41621674  0.41366325
   0.11858838 -0.21697531  0.09930879  0.07686047  0.08734151  0.1206127
  -0.1182971  -0.9044713   0.06241615  0.20098946  0.89389629  1.00118343]]
In [84]:
#Calculating Eigen Vectors & Eigen Values:

eigenvalues, eigenvectors = np.linalg.eig(cov_matrix)
print('Eigen Vectors \n%s', eigenvectors)
print('\n Eigen Values \n%s', eigenvalues)
Eigen Vectors 
%s [[-2.72480542e-01 -8.71212662e-02 -3.78964434e-02 -1.38548866e-01
   1.36797277e-01 -2.64261836e-01 -2.03865230e-01  7.61517056e-01
  -3.61009519e-01 -1.55568001e-01 -8.83359803e-02 -2.04647786e-02
  -1.65211759e-02  6.68534883e-02  3.45967273e-02 -9.24440830e-02
   8.93635473e-02 -4.78840947e-02]
 [-2.87356007e-01  1.32310949e-01 -2.01243444e-01  3.74762788e-02
  -1.37973644e-01  7.00378119e-02  3.90705579e-01  6.78349827e-02
  -5.20951662e-02  1.82388332e-01  3.19036821e-02 -1.40235218e-01
  -5.15200341e-02  5.70611288e-02 -6.91843606e-01 -1.06380826e-01
   2.82335282e-01  2.11119309e-01]
 [-3.02364527e-01 -4.58975423e-02  6.32692058e-02 -1.08738857e-01
  -7.98038002e-02  1.73699112e-02 -1.63453860e-01 -2.79698372e-01
  -8.68769674e-02 -2.54218483e-01 -4.87416369e-01 -6.44944661e-01
   8.88959542e-03 -1.58478895e-01  5.39689053e-03  5.67471350e-02
  -1.09970100e-01  1.13061599e-01]
 [-2.69713182e-01 -1.97593670e-01  5.55267284e-02  2.54696204e-01
   1.34068249e-01  1.38351971e-01 -1.62429091e-01 -1.09116758e-01
  -2.65456066e-01  4.12533680e-02  5.55060194e-01 -9.22358214e-02
   4.87406740e-03 -3.69843898e-01  1.79537977e-01  1.15224879e-01
   2.12891593e-01  3.58389654e-01]
 [-9.78895161e-02 -2.57549687e-01 -6.33360049e-02  6.12982351e-01
   1.23865611e-01  5.77375650e-01 -9.17925772e-02  1.87735278e-01
   4.00843214e-02  4.02002985e-02 -2.67374459e-01  3.19499600e-02
   7.34107267e-03  1.53294232e-01 -6.23133734e-02 -1.57297823e-02
  -1.39425841e-01 -1.70574229e-01]
 [-1.95149640e-01 -1.08012902e-01 -1.48284087e-01 -2.79101376e-01
  -6.34816892e-01  2.90741644e-01 -3.97306661e-01  4.53920390e-02
   1.36863582e-01 -1.87151698e-01  1.88706313e-01  2.24821942e-01
   2.34920303e-03  1.40659437e-01 -9.12201306e-02  6.51322028e-02
  -1.34461664e-01  1.12167932e-01]
 [-3.10297155e-01  7.51867478e-02  1.09270484e-01 -5.50928653e-03
   8.58243500e-02 -9.76416567e-02 -9.30433825e-02 -6.61190224e-02
   1.32639285e-01  1.51458837e-01 -9.48166329e-02  1.67883045e-01
   8.52278433e-01  5.31562911e-02 -3.69370855e-02  1.73206301e-01
   1.21091826e-01 -5.67779801e-02]
 [ 3.08913032e-01 -1.31637742e-02 -9.11579263e-02 -6.55639207e-02
  -7.89645944e-02  7.54987038e-02  1.05034231e-01  1.95988423e-01
  -2.90881400e-01  8.14429806e-02  3.66300648e-02 -3.04959685e-02
   2.54301937e-01 -4.92267062e-01 -2.79251897e-01  2.40257917e-01
  -5.41920907e-01 -2.26966653e-02]
 [-3.07274545e-01  8.76249676e-02  1.05838147e-01 -3.07261801e-02
   8.05236243e-02 -1.06044536e-01 -9.17599396e-02 -1.47648628e-02
   9.42739298e-02  2.44473529e-01 -1.49143212e-01  2.26896348e-01
  -4.32223502e-01 -1.33483599e-01 -1.02250959e-01  6.83918261e-01
   4.35613092e-03 -1.84816239e-01]
 [-2.78105311e-01  1.22110545e-01 -2.13511404e-01 -4.19503636e-02
  -2.50954760e-01  7.84971684e-02  3.55464890e-01  2.15521432e-01
   1.67047737e-01  3.75670008e-01  1.49974722e-01 -3.23908983e-01
   2.44152519e-02  3.88898260e-04  5.09345227e-01  1.11127226e-02
  -1.69828158e-01 -1.81709563e-01]
 [-2.99799475e-01  7.69453365e-02  1.45051485e-01  6.44515527e-02
   1.47403599e-01 -1.32604488e-01 -6.87775590e-02 -1.92918622e-01
  -4.00055108e-02 -1.82596867e-01  4.49378735e-01 -1.29816513e-01
  -3.94958892e-02  1.33228523e-01 -2.66426259e-01 -1.85791866e-01
  -3.58354240e-01 -5.39241421e-01]
 [-3.05905185e-01  7.10154966e-02  1.09637942e-01  2.00046625e-03
   1.09422018e-01 -1.15068336e-01 -8.88472059e-02 -3.65516316e-02
   1.47211690e-01  2.82934356e-01 -1.82871411e-01  3.21181561e-01
  -1.25917579e-01 -2.29631718e-01  1.51891869e-02 -4.99259311e-01
  -4.18509164e-01  3.51228496e-01]
 [-2.63176686e-01  2.10656144e-01 -2.02986744e-01  8.51739884e-02
  -5.01377293e-03  6.67558704e-02  4.55967383e-01 -1.45629369e-01
  -2.75378898e-01 -5.43222619e-01 -1.08582782e-01  3.96618607e-01
   1.73253454e-02 -3.18744171e-02  2.15925572e-01  8.42029060e-02
  -8.75645749e-02  3.98693899e-02]
 [ 4.22576696e-02  5.03908123e-01  7.36081661e-02  1.15899026e-01
   1.37967876e-01  1.31059677e-01 -8.52990389e-02  3.22614657e-01
   5.52284490e-01 -3.74124427e-01  1.11781407e-01 -1.28475914e-01
   4.73244490e-03 -2.95288536e-01 -5.39661018e-02  3.55410883e-02
   5.58216155e-02  9.68223327e-02]
 [-3.59638720e-02 -1.56907396e-02 -5.58837796e-01 -4.74103090e-01
   5.66969855e-01  3.18406181e-01 -1.24736183e-01 -1.14119189e-01
   6.05989812e-02  5.62025821e-02  3.36071591e-02 -2.70094604e-03
  -1.12333567e-03  3.14673390e-03 -9.77955603e-03 -1.80284519e-02
   1.20154730e-03 -3.95776024e-02]
 [-5.88316372e-02 -9.27881036e-02  6.71061152e-01 -4.27161071e-01
   1.32564036e-01  4.68256728e-01  3.02661170e-01  1.16553173e-01
  -5.11483744e-02 -1.37315635e-02  3.49397516e-02  1.49652167e-02
  -9.56977328e-03  8.24600688e-02  9.22382419e-03  2.78870317e-04
  -4.67365389e-03  4.31954057e-02]
 [-3.79251097e-02 -5.01645627e-01 -6.24379541e-02  2.74501144e-02
   1.79988899e-01 -2.80510248e-01  2.57971188e-01  9.02193671e-02
   3.78035382e-01 -1.96900365e-01  1.23194106e-01 -8.68401031e-02
   2.48495218e-02  2.60428109e-01 -6.13428791e-02  2.58536148e-01
  -2.97670458e-01  3.52760953e-01]
 [-8.47087648e-02 -5.07515927e-01 -4.16776253e-02 -9.58570108e-02
  -1.11007988e-01 -5.90960958e-02  1.74431810e-01  2.78968261e-03
   2.76197478e-01 -1.36102860e-01 -7.84194526e-02  1.29537828e-01
  -1.10217755e-03 -5.39254735e-01 -4.19654508e-02 -2.10382470e-01
   2.77814382e-01 -3.82542502e-01]]

 Eigen Values 
%s [9.75341259e+00 3.35358815e+00 1.19269480e+00 1.13414646e+00
 8.83670742e-01 6.65920199e-01 3.17652965e-01 2.27359876e-01
 1.28737895e-01 7.95035982e-02 7.31367700e-02 6.45023287e-02
 5.96258031e-03 3.96125443e-02 1.89164422e-02 2.20443539e-02
 3.13454635e-02 2.90940229e-02]
In [85]:
#Sort eigenvalues in descending order

# Make a set of (eigenvalue, eigenvector) pairs:
eig_pairs = [(eigenvalues[i], eigenvectors[:,i]) for i in range(len(eigenvalues))]

# Sort the (eigenvalue, eigenvector) pairs from highest to lowest with respect to eigenvalue
eig_pairs.sort()

eig_pairs.reverse()
print(eig_pairs)

# Extract the descending ordered eigenvalues and eigenvectors
eigvalues_sorted = [eig_pairs[index][0] for index in range(len(eigenvalues))]
eigvectors_sorted = [eig_pairs[index][1] for index in range(len(eigenvalues))]

# Let's confirm our sorting worked, print out eigenvalues
print('Eigenvalues in descending order: \n%s' %eigvalues_sorted)
[(9.753412591212186, array([-0.27248054, -0.28735601, -0.30236453, -0.26971318, -0.09788952,
       -0.19514964, -0.31029716,  0.30891303, -0.30727454, -0.27810531,
       -0.29979947, -0.30590519, -0.26317669,  0.04225767, -0.03596387,
       -0.05883164, -0.03792511, -0.08470876])), (3.3535881499853644, array([-0.08712127,  0.13231095, -0.04589754, -0.19759367, -0.25754969,
       -0.1080129 ,  0.07518675, -0.01316377,  0.08762497,  0.12211054,
        0.07694534,  0.0710155 ,  0.21065614,  0.50390812, -0.01569074,
       -0.0927881 , -0.50164563, -0.50751593])), (1.1926947965120702, array([-0.03789644, -0.20124344,  0.06326921,  0.05552673, -0.063336  ,
       -0.14828409,  0.10927048, -0.09115793,  0.10583815, -0.2135114 ,
        0.14505148,  0.10963794, -0.20298674,  0.07360817, -0.5588378 ,
        0.67106115, -0.06243795, -0.04167763])), (1.1341464565152917, array([-0.13854887,  0.03747628, -0.10873886,  0.2546962 ,  0.61298235,
       -0.27910138, -0.00550929, -0.06556392, -0.03072618, -0.04195036,
        0.06445155,  0.00200047,  0.08517399,  0.11589903, -0.47410309,
       -0.42716107,  0.02745011, -0.09585701])), (0.8836707417709512, array([ 0.13679728, -0.13797364, -0.0798038 ,  0.13406825,  0.12386561,
       -0.63481689,  0.08582435, -0.07896459,  0.08052362, -0.25095476,
        0.1474036 ,  0.10942202, -0.00501377,  0.13796788,  0.56696985,
        0.13256404,  0.1799889 , -0.11100799])), (0.6659201987806359, array([-0.26426184,  0.07003781,  0.01736991,  0.13835197,  0.57737565,
        0.29074164, -0.09764166,  0.0754987 , -0.10604454,  0.07849717,
       -0.13260449, -0.11506834,  0.06675587,  0.13105968,  0.31840618,
        0.46825673, -0.28051025, -0.0590961 ])), (0.31765296517540975, array([-0.20386523,  0.39070558, -0.16345386, -0.16242909, -0.09179258,
       -0.39730666, -0.09304338,  0.10503423, -0.09175994,  0.35546489,
       -0.06877756, -0.08884721,  0.45596738, -0.08529904, -0.12473618,
        0.30266117,  0.25797119,  0.17443181])), (0.22735987599959928, array([ 0.76151706,  0.06783498, -0.27969837, -0.10911676,  0.18773528,
        0.04539204, -0.06611902,  0.19598842, -0.01476486,  0.21552143,
       -0.19291862, -0.03655163, -0.14562937,  0.32261466, -0.11411919,
        0.11655317,  0.09021937,  0.00278968])), (0.1287378952449227, array([-0.36100952, -0.05209517, -0.08687697, -0.26545607,  0.04008432,
        0.13686358,  0.13263928, -0.2908814 ,  0.09427393,  0.16704774,
       -0.04000551,  0.14721169, -0.2753789 ,  0.55228449,  0.06059898,
       -0.05114837,  0.37803538,  0.27619748])), (0.07950359823116333, array([-0.155568  ,  0.18238833, -0.25421848,  0.04125337,  0.0402003 ,
       -0.1871517 ,  0.15145884,  0.08144298,  0.24447353,  0.37567001,
       -0.18259687,  0.28293436, -0.54322262, -0.37412443,  0.05620258,
       -0.01373156, -0.19690036, -0.13610286])), (0.07313676996518041, array([-0.08833598,  0.03190368, -0.48741637,  0.55506019, -0.26737446,
        0.18870631, -0.09481663,  0.03663006, -0.14914321,  0.14997472,
        0.44937873, -0.18287141, -0.10858278,  0.11178141,  0.03360716,
        0.03493975,  0.12319411, -0.07841945])), (0.06450232873742458, array([-0.02046478, -0.14023522, -0.64494466, -0.09223582,  0.03194996,
        0.22482194,  0.16788304, -0.03049597,  0.22689635, -0.32390898,
       -0.12981651,  0.32118156,  0.39661861, -0.12847591, -0.00270095,
        0.01496522, -0.0868401 ,  0.12953783])), (0.03961254427386255, array([ 6.68534883e-02,  5.70611288e-02, -1.58478895e-01, -3.69843898e-01,
        1.53294232e-01,  1.40659437e-01,  5.31562911e-02, -4.92267062e-01,
       -1.33483599e-01,  3.88898260e-04,  1.33228523e-01, -2.29631718e-01,
       -3.18744171e-02, -2.95288536e-01,  3.14673390e-03,  8.24600688e-02,
        2.60428109e-01, -5.39254735e-01])), (0.03134546346864059, array([ 0.08936355,  0.28233528, -0.1099701 ,  0.21289159, -0.13942584,
       -0.13446166,  0.12109183, -0.54192091,  0.00435613, -0.16982816,
       -0.35835424, -0.41850916, -0.08756457,  0.05582162,  0.00120155,
       -0.00467365, -0.29767046,  0.27781438])), (0.029094022916380715, array([-0.04788409,  0.21111931,  0.1130616 ,  0.35838965, -0.17057423,
        0.11216793, -0.05677798, -0.02269667, -0.18481624, -0.18170956,
       -0.53924142,  0.3512285 ,  0.03986939,  0.09682233, -0.0395776 ,
        0.04319541,  0.35276095, -0.3825425 ])), (0.022044353854418452, array([-9.24440830e-02, -1.06380826e-01,  5.67471350e-02,  1.15224879e-01,
       -1.57297823e-02,  6.51322028e-02,  1.73206301e-01,  2.40257917e-01,
        6.83918261e-01,  1.11127226e-02, -1.85791866e-01, -4.99259311e-01,
        8.42029060e-02,  3.55410883e-02, -1.80284519e-02,  2.78870317e-04,
        2.58536148e-01, -2.10382470e-01])), (0.018916442198418492, array([ 0.03459673, -0.69184361,  0.00539689,  0.17953798, -0.06231337,
       -0.09122013, -0.03693709, -0.2792519 , -0.10225096,  0.50934523,
       -0.26642626,  0.01518919,  0.21592557, -0.0539661 , -0.00977956,
        0.00922382, -0.06134288, -0.04196545])), (0.005962580305987046, array([-0.01652118, -0.05152003,  0.0088896 ,  0.00487407,  0.00734107,
        0.0023492 ,  0.85227843,  0.25430194, -0.4322235 ,  0.02441525,
       -0.03949589, -0.12591758,  0.01732535,  0.00473244, -0.00112334,
       -0.00956977,  0.02484952, -0.00110218]))]
Eigenvalues in descending order: 
[9.753412591212186, 3.3535881499853644, 1.1926947965120702, 1.1341464565152917, 0.8836707417709512, 0.6659201987806359, 0.31765296517540975, 0.22735987599959928, 0.1287378952449227, 0.07950359823116333, 0.07313676996518041, 0.06450232873742458, 0.03961254427386255, 0.03134546346864059, 0.029094022916380715, 0.022044353854418452, 0.018916442198418492, 0.005962580305987046]
In [86]:
tot = sum(eigenvalues)
var_explained = [(i / tot) for i in eigvalues_sorted]  # an array of variance explained by each 
# eigen vector... there will be 18 entries as there are 18 eigen vectors)
cum_var_exp = np.cumsum(var_explained)  # an array of cumulative variance. There will be 18 entries with 18 th entry 
# cumulative reaching almost 100%


print('Cumulative Variance explained:\n' , cum_var_exp)
Cumulative Variance explained:
 [0.54121576 0.72730599 0.79348849 0.85642215 0.90545694 0.94240878
 0.9600353  0.97265148 0.97979513 0.98420677 0.98826512 0.99184435
 0.99404245 0.9957818  0.99739623 0.99861947 0.99966914 1.        ]
In [87]:
# Plotting the Explained variance and principal components
plt.figure(figsize=(10,5))
plt.bar(range(1,19), var_explained, alpha=0.5, align='center', label='individual explained variance')
plt.step(range(1,19),cum_var_exp, where= 'mid', label='cumulative explained variance')
plt.ylabel('Explained variance ratio')
plt.xlabel('Principal components')
plt.show()

# From below we plot we can clealry observe that 10 dimension() are able to explain 98 %variance of data. 
# so we will use first 10 principal components going forward and calulate the reduced dimensions.
In [88]:
# P_reduce represents reduced mathematical space....

x_reduce = np.array(eigvectors_sorted[0:10])   # Reducing from 18 to 10 dimension space

x_pca_10D = np.dot(x_sc,x_reduce.T)   # projecting original data into principal component dimensions

x_reduced_pca = pd.DataFrame(x_pca_10D)  # converting array to dataframe for pairplot

x_reduced_pca
Out[88]:
0 1 2 3 4 5 6 7 8 9
0 -0.582592 -0.675578 -0.455460 0.749984 -0.775955 1.848623 0.183261 0.687267 -0.306152 0.154516
1 1.514172 -0.350376 -0.331585 -1.269450 -0.325628 0.119446 -0.202006 -0.109411 0.285522 -0.387734
2 -3.911615 0.234211 -1.266354 -0.138470 0.915057 0.684241 -0.811789 -0.172951 -0.202771 -0.521269
3 1.536810 -3.045725 -0.469895 -0.324979 -0.614045 -0.366162 -0.116718 0.191698 0.391095 0.252646
4 0.647023 1.528621 -0.240215 0.560100 0.484285 1.023379 -0.478345 -1.225594 -1.434776 -0.072792
5 -5.419513 4.672786 1.147287 -0.236358 1.562894 -2.500587 -0.312851 -0.434780 0.230064 -0.542570
6 0.815643 -2.221092 -1.963951 0.408098 1.519612 -0.659196 0.401128 0.144841 0.139181 -0.134920
7 1.959624 -1.556471 -1.008601 0.900549 -1.215177 -0.064183 0.331325 0.339326 -0.014181 -0.049429
8 4.381643 -3.292170 0.571450 -0.050737 -0.444405 -0.668010 0.353479 0.217374 0.426039 0.078505
9 -1.237986 -1.991085 0.484692 -0.475960 -1.034813 -0.369266 -0.691100 -0.703192 0.576042 0.087330
10 3.315035 -2.055567 0.284607 0.016131 -1.104047 -0.333382 -0.444129 -0.141231 0.241347 -0.052898
11 4.447121 -2.328619 1.460541 -1.452220 0.497996 -0.543785 0.373590 0.175080 -0.414819 -0.191973
12 0.893250 -0.172618 -0.299959 1.430342 0.345927 0.687144 0.999800 -0.147470 -0.353137 -0.015226
13 1.260274 -0.063766 -0.339415 -1.050817 -0.803472 0.407997 -0.430517 -0.325647 0.247350 -0.340373
14 -1.079054 -0.947328 -1.022803 2.420468 1.247141 -0.250841 1.102588 -0.005884 0.139222 -0.027459
15 -3.847905 1.299656 -1.122232 1.266373 -0.304335 0.013908 0.386124 -0.716889 -0.212858 -0.429352
16 5.482092 1.907772 0.892705 -0.598564 -0.365185 -0.457342 -0.240698 1.129261 -0.347325 0.146113
17 -0.305306 -1.618186 0.626744 1.665372 1.393557 -0.588579 -0.468218 0.552195 0.530448 -0.039695
18 -4.248125 1.321889 -0.202380 0.010871 -0.641413 -0.283888 0.117175 0.298761 0.010870 0.153813
19 -4.240374 1.258194 -0.797361 0.609182 -0.481305 -0.214388 -0.082359 -0.159258 -0.247107 0.089906
20 1.502297 1.059292 -0.104313 1.894203 -0.596342 -0.160582 0.695860 -0.410126 -0.038335 0.015590
21 5.350802 2.264787 -0.557775 0.691875 0.603154 0.093645 -0.838308 0.409236 -0.151341 0.220638
22 1.096016 -2.285354 -1.672887 1.238262 0.740155 -0.162052 0.488986 0.414855 0.446217 -0.269238
23 2.758118 -1.012160 -0.094671 0.977592 -0.670296 -0.985528 -0.143179 -0.200767 0.225653 0.069330
24 -4.123850 -0.606884 -0.188536 1.352897 -1.523549 -0.283421 0.109308 -0.395592 -0.239279 -0.357369
25 1.313110 -0.322142 -0.476356 1.065244 -1.582514 0.142990 0.269664 -0.343731 0.190129 -0.164630
26 5.020837 2.384473 -0.232181 0.357604 0.233111 -0.004699 -0.947301 0.192218 0.031235 0.082716
27 -4.815353 0.167382 1.582172 -0.070054 -0.852098 0.585047 0.356099 0.851365 -0.201646 0.005738
28 -1.409936 -0.045031 0.274895 1.136416 1.582476 -1.083382 -0.602485 0.480334 0.553059 0.006659
29 3.362503 2.431372 0.784302 -0.916572 0.656063 0.915891 -0.361857 -0.485461 0.530774 -0.265507
30 0.627334 -0.028730 -0.549683 0.131999 -1.508334 0.964614 -0.574116 -0.141099 0.068127 -0.300862
31 1.942175 -2.196118 -0.996637 -0.999082 -0.021527 -0.365562 0.727153 -0.525523 0.211157 -0.143549
32 3.056427 -2.405725 0.547528 -0.246841 0.606096 -1.121335 -0.176285 0.119262 -0.070117 0.252569
33 -4.124110 -1.119033 2.269987 -0.396676 0.373974 1.580519 0.143834 -0.040369 -0.239353 -0.436845
34 1.051840 -2.850498 2.105487 -0.247140 -0.151080 -0.368945 -0.075212 -0.892494 0.343711 0.020306
35 -0.172614 -1.362454 -2.361522 -0.573676 0.887522 0.970307 -0.211169 0.441066 -0.375318 -0.057539
36 2.435777 3.157830 -0.169547 0.212369 -0.979693 -0.833806 0.185632 -0.508597 0.480661 -0.166960
37 -0.555509 0.848049 0.828024 0.787128 -0.861240 -0.042910 0.881624 -0.628485 -0.829479 -0.862990
38 -4.064261 1.399827 0.273086 -0.343430 -1.183640 -1.677580 0.259778 0.327727 0.116278 -0.160333
39 1.633112 0.932640 -1.242112 2.529186 0.453308 1.393207 0.127624 -0.530042 -0.110586 0.392416
40 -3.049894 0.575645 0.274585 1.262725 0.196753 0.359641 -0.890630 -0.794011 -0.091748 -0.251215
41 5.639744 2.755611 0.459628 -1.062321 0.777765 0.186043 -0.272275 1.195607 0.059794 0.079071
42 0.071199 1.457143 -1.079941 -0.940595 -2.031572 -0.287136 0.012342 0.235289 0.075832 -0.246427
43 1.016873 -1.382964 0.383108 0.700684 0.160474 -0.647654 -1.211873 -0.332298 -0.082754 0.159425
44 -5.439289 -0.943686 -1.474876 0.365929 -0.834311 -0.905637 -0.699247 1.050021 -0.945798 -0.549659
45 0.224650 1.381098 -0.686674 0.007634 -2.126522 -0.087370 -0.204721 0.413114 0.237949 -0.454943
46 2.760109 -0.020206 -0.159704 -0.230071 -1.385640 -0.911906 0.581331 0.461085 -0.379280 -0.011746
47 2.741687 2.186503 0.276818 -0.576748 0.060093 -0.138326 0.419455 -0.582886 -0.861873 0.489109
48 0.263407 0.934880 -0.712463 -0.130506 -1.546224 1.460211 0.203643 0.392374 0.363143 -0.086381
49 -0.020109 -2.415741 0.134078 0.250327 -1.300949 -1.231807 0.979805 -0.511551 0.162848 -0.187524
50 4.082883 2.283723 0.462711 0.040551 -0.485424 -1.105922 -0.335743 -0.986786 0.205190 0.291294
51 1.773668 -1.090601 1.604388 0.346629 0.598825 0.784643 -0.515945 0.318980 -0.230767 0.306783
52 -4.633719 0.429277 -0.181839 2.271811 -0.541135 0.160935 0.524393 -0.389938 -0.362457 -0.242362
53 1.107638 -3.142681 -0.550792 0.682362 1.087443 -0.610700 0.884005 1.072352 0.064590 -0.215464
54 -5.673571 4.200468 2.264686 -0.592775 1.510651 -0.984481 0.547766 -0.505672 0.311540 0.661573
55 2.967774 -3.392095 -1.240188 -0.436089 0.098666 -1.028148 -0.379873 0.353624 0.330770 0.223122
56 -1.342117 -1.160456 0.233875 0.470101 -0.256765 -0.612942 -0.926079 -0.524656 -0.266491 0.125124
57 0.676108 1.435996 -0.682350 -1.007927 -2.038005 0.211971 -0.041648 -0.063752 0.142192 0.116913
58 -4.440119 -0.844122 -0.446805 1.415042 -1.387509 -0.955640 -0.505289 0.198753 -0.587270 -0.035613
59 4.296136 1.636252 -0.298832 -0.794348 0.371359 -0.552285 0.030477 -0.229995 -0.472904 0.420156
60 -2.959302 -1.906786 -0.660085 0.540788 -0.231272 -1.149498 0.102957 -0.050310 -0.101017 0.143070
61 4.423594 1.326667 0.209257 -0.795846 1.532780 1.511083 0.134951 -0.514799 0.265737 0.406070
62 3.136010 2.108487 -0.281713 -1.873838 0.116707 -0.282262 -0.760361 0.966419 -0.191429 -0.143117
63 2.215005 1.346047 -0.432000 1.805804 -0.190684 0.718054 -0.489856 -0.121177 0.248826 0.369488
64 -1.150740 -0.705043 0.397640 2.401114 0.173242 -0.581578 -0.175806 -0.261818 0.335253 -0.120669
65 2.337390 1.307714 -1.749966 -1.297799 1.456146 0.340804 -0.890032 -0.475896 -0.031740 0.068976
66 2.408588 1.948735 0.292242 -0.714366 -0.613989 0.911919 0.332596 -0.691661 -0.454399 0.567395
67 -5.139775 0.695816 -0.123702 0.855518 -0.488585 1.039518 -0.064865 -0.048627 0.475613 0.620220
68 1.414761 -1.133360 -0.050325 1.196776 -1.345441 0.863625 0.477732 -0.007612 0.084369 -0.297843
69 -2.313100 -0.546370 -0.245157 2.612998 0.918687 0.373552 0.289497 0.386930 0.150246 -0.234144
70 -3.209779 2.175071 -0.445105 -0.246234 -1.434607 -1.036969 0.636531 -0.414743 0.510552 -0.120180
71 -5.747297 0.154351 -0.102963 -0.072309 -0.258286 2.144828 0.683582 -0.241071 0.133956 1.093396
72 -0.173979 -1.538598 1.781368 -0.079910 0.205119 -0.019789 -0.506028 -0.651734 -0.031762 -0.028533
73 5.482928 2.814745 1.172595 0.041466 -0.717369 0.496809 0.149024 -0.423623 0.114141 0.268653
74 0.913852 -0.526578 -0.094490 -1.684461 -0.599868 1.625825 -0.357173 -0.199321 0.333223 -0.491361
75 -3.123755 -0.305343 -0.772583 0.662296 -0.453098 -0.566717 0.223522 -0.232829 -0.470005 -0.083790
76 0.614868 -0.027752 1.262200 0.703394 -0.361702 -0.834395 -1.025069 -0.510162 0.115181 -0.146614
77 2.715247 1.495070 -0.045991 1.231827 -0.480587 -0.069037 -0.527823 -0.335467 -0.748244 0.221318
78 -3.163644 1.135160 -1.025979 1.001536 2.174315 -0.860031 0.537394 0.316034 0.376308 0.080697
79 2.289343 2.699695 -0.673480 -0.832480 -0.614587 -0.935875 0.331254 -0.443566 -0.964916 0.283008
80 1.475821 0.832446 -0.682326 2.063055 -0.259744 -0.090960 0.524205 -0.180321 -0.412463 0.092462
81 -3.127808 1.393269 0.494864 1.600082 1.685231 -0.614622 0.584686 -0.000896 0.201085 0.107147
82 3.866095 -1.271037 -0.034136 -0.201579 -0.765723 -2.120945 -0.439003 0.476704 -0.282827 0.195054
83 2.751955 1.069666 1.560689 -1.632939 0.228416 1.196625 0.218197 -0.928772 0.225531 0.112415
84 1.435706 -1.595407 0.145860 2.498252 0.410152 1.041995 -0.559342 0.284079 0.217631 -0.052634
85 -5.258357 4.417549 0.150205 -0.702040 1.497894 -1.474877 0.667936 0.028283 -0.651307 -0.762353
86 1.480498 -0.338754 0.539777 -0.808933 -0.967221 0.197506 0.186247 -0.098554 0.253296 -0.423511
87 5.085213 0.583276 0.307709 -0.088297 -0.322471 -1.011052 0.269583 0.278400 -0.526316 0.430139
88 -0.077249 -2.160685 0.641612 2.422411 0.997863 0.578443 -0.094158 -0.178737 0.187993 0.000228
89 5.184358 2.383025 -0.310638 -0.217187 0.273014 0.163252 -0.852976 -0.204240 0.052888 0.303428
90 -5.199853 0.068939 -0.221732 1.082452 -0.956857 0.298398 -0.002825 0.153035 -0.237119 -0.088669
91 0.763098 -0.458473 0.428522 -1.350542 0.410537 -0.580328 -1.138494 -0.679229 -0.070781 -0.458190
92 -3.399765 0.188378 -0.937246 -0.540156 0.393404 -0.557373 0.409169 -0.214348 -0.456769 -0.672471
93 -0.223562 0.614663 -0.167814 0.098336 -1.318942 1.097096 0.262665 0.604881 -0.108737 -0.201027
94 2.185579 1.060672 -0.385755 1.809184 -0.340591 0.181421 0.457730 -0.251027 -0.462260 0.415610
95 -4.154027 0.064350 1.329665 -0.381199 0.335102 1.199190 0.067697 -0.642593 -0.066567 -0.377812
96 1.962258 0.737972 -1.204780 -0.776694 1.780253 1.193647 -0.166596 -0.364047 -0.403568 0.026262
97 1.904537 0.534032 0.024981 0.788972 -0.077074 0.069340 0.201277 -0.106693 0.271796 0.006722
98 -3.167897 -1.345081 2.364550 -0.201933 0.609095 1.624245 0.368697 -0.598473 -0.184642 -0.466631
99 2.657125 3.449486 0.432656 0.204048 0.079027 0.166811 0.232500 0.565062 0.376068 -0.206750
100 0.552652 1.187297 0.003733 2.291001 -0.534640 0.195680 -0.601149 -1.456725 -1.563142 0.057830
101 0.735367 -2.419128 -1.470102 -0.051875 0.142246 0.192920 -0.531982 0.039083 0.103560 0.012135
102 2.568695 -0.955208 -2.029696 -0.261273 0.856413 0.487045 0.113273 0.601934 -0.441295 0.127369
103 4.574906 -0.511303 -1.701670 -0.331961 1.422858 0.245070 -0.016191 0.847404 -0.461017 0.249342
104 -1.504952 0.345989 2.672719 1.194105 1.582710 -0.329346 0.272536 0.977160 0.309535 -0.138175
105 -4.067447 0.083301 -0.568773 -0.515924 0.505073 0.213671 -0.801943 0.559264 0.250617 0.089502
106 -2.849563 -2.241990 2.478255 -0.549835 -0.963978 0.486588 -0.209905 -0.034933 0.065898 0.091303
107 2.386201 0.278728 1.468732 0.184896 -0.880930 0.035857 -0.636945 -0.384834 0.003361 0.147917
108 2.287005 2.363549 -0.166377 -0.021013 -0.356019 1.014995 0.044521 -0.477868 0.357015 0.106329
109 -1.319874 -0.423321 -0.004378 1.676859 1.164211 -0.408510 0.152576 0.625411 0.437973 0.407242
110 1.863794 -1.135377 0.078641 1.098740 -1.336284 -0.130939 -0.552815 0.130512 0.216348 -0.039520
111 0.138804 0.300656 -0.233098 0.180443 -1.230421 0.980254 0.213157 0.523568 -0.215495 -0.445295
112 3.163658 1.591383 0.092945 -1.127349 1.771771 1.689416 -0.681989 -1.099893 0.609236 0.367013
113 5.653634 0.979037 -0.434436 0.264885 0.403723 -0.297379 -0.446716 0.581167 -0.990523 0.272211
114 1.008956 0.825049 -0.920761 -2.009153 -0.543144 0.359159 -0.381988 0.074370 0.311859 -0.263995
115 -0.384773 -0.459348 -1.389670 -0.889625 -0.552853 1.288227 -0.094859 0.287421 0.075308 -0.274087
116 -2.644508 0.017425 0.186464 1.193832 0.632932 -0.656800 -1.118706 -0.492546 -0.171988 -0.261203
117 -5.518136 -0.516670 0.076854 -1.030393 0.461203 1.922209 -0.476136 0.697251 -0.014247 -0.023655
118 2.005490 2.655229 -0.211303 -0.843868 -0.126289 0.852144 -0.130255 -0.228990 0.195992 -0.315607
119 -0.922652 -1.055965 -0.456653 0.932464 0.210414 -0.314754 1.290211 0.060812 0.576282 0.056051
120 4.317525 1.751159 -0.627503 -1.612291 2.049737 0.156640 -0.315628 0.269767 -0.040808 0.082029
121 0.313839 1.352807 -1.225690 -1.001667 -1.117760 1.058243 -0.018027 0.171120 0.354311 0.025129
122 1.496607 -2.774687 -1.501499 -0.027131 -0.235679 -0.657042 -0.604822 -0.231362 0.488469 -0.002369
123 4.623643 -0.945202 0.806346 -1.074944 0.352555 0.108691 0.482761 0.642059 -0.737443 0.237238
124 1.743911 0.213510 -0.637957 1.131447 -1.125952 0.008598 0.479240 -0.240130 0.011163 -0.057380
125 0.366024 0.741537 -2.364345 -1.261205 -0.160145 1.488540 -0.483106 -0.128209 0.413225 -0.020219
126 2.127283 0.903082 0.121380 1.041322 -0.372343 -0.191313 -0.247282 0.287130 0.064211 0.122303
127 2.121167 0.508064 0.370646 0.438538 -0.009306 1.246416 -0.311099 -0.029025 0.111992 0.195676
128 -0.153186 -1.557046 -0.801905 -0.089152 -0.616485 0.812150 -0.257867 0.562504 -0.050810 0.284163
129 -2.674802 -0.100551 0.108933 1.247796 1.293840 0.000948 -0.223752 -0.073244 -0.038121 -0.138743
130 -2.508988 0.202538 -0.416843 -0.941168 1.076752 -0.027406 -0.792216 -0.573701 0.075606 -0.614448
131 2.261762 -2.346819 2.687398 -0.464304 -0.029840 0.032166 0.462863 -0.406209 0.149503 -0.121205
132 -1.308875 -1.675987 0.251890 -0.561265 0.193532 -0.938809 -0.818400 -0.817086 0.226322 -0.546018
133 3.382158 1.420123 -0.463061 -0.804915 -0.550184 -1.907825 -0.653090 0.949921 -0.509242 0.085567
134 -3.739377 1.509303 0.285194 -2.523720 0.219547 0.148176 0.588908 0.225622 0.676718 0.291800
135 -0.166095 0.788876 0.713916 0.685708 -1.140652 0.062528 0.656086 -0.272160 -0.368095 0.179627
136 0.741268 1.606302 -1.113194 0.238608 -2.011585 -0.097625 0.292142 -0.128735 0.440793 0.316796
137 2.430938 -1.526237 -1.658010 0.324713 -1.105195 0.239283 -0.089237 0.027817 0.179261 -0.042082
138 4.258435 0.720410 -0.186067 -1.302981 1.642789 0.953546 0.056250 0.252151 -0.659641 0.316007
139 1.407636 -0.908193 -0.292025 1.043589 -0.677412 0.043157 -0.391660 0.156790 0.065407 0.166785
140 1.444337 -3.601775 1.112534 -0.837981 -0.520663 -1.034113 -0.350959 -0.579629 0.526031 0.295638
141 2.828678 3.377576 -0.332391 -0.097226 -0.439832 0.422446 -0.272778 -0.111229 0.762404 -0.179119
142 -3.994492 -1.341766 2.935401 -1.775417 -1.016956 -0.202878 0.298175 0.447841 0.129825 0.101792
143 2.626520 3.365271 0.028372 -0.063144 -0.821474 0.174145 -0.034485 -0.355943 0.723182 -0.300486
144 -0.178230 -2.176987 -0.361130 -0.550257 1.169929 -0.044603 0.892918 -0.217990 -0.017255 -0.126475
145 -5.095325 -0.495241 0.892945 0.223236 -1.689333 0.017542 -0.117608 0.110138 -0.069611 0.654121
146 -0.499533 -0.314885 -3.053991 -0.962758 0.085321 0.839003 -1.011647 0.584080 0.207567 0.222910
147 1.672994 -1.700184 0.719542 0.673007 0.253832 0.476917 -0.073668 0.134017 -0.125175 0.091390
148 0.917769 -3.138531 -1.705277 -1.182994 0.902261 -0.514006 0.664149 -0.711320 0.587586 0.190790
149 2.550349 -2.650013 1.674699 0.204667 -0.173641 1.237323 0.135340 1.077823 -0.111524 0.125896
150 -2.821472 -1.899792 -0.420054 0.722141 -0.784830 -0.655720 -0.007415 0.225419 -0.331666 -0.287400
151 -1.190617 -1.458689 1.528819 1.873155 1.578866 0.887435 -0.052277 0.266242 0.559096 0.363431
152 2.040908 -4.019783 1.819776 -0.842340 0.864649 -0.212255 0.335030 0.081868 0.291333 -0.207824
153 -3.794540 -0.961490 1.745442 0.114040 -0.238699 -0.217688 -0.099603 0.341673 -0.388407 0.147732
154 1.857008 -0.642292 -0.698416 0.079874 -0.326587 0.549592 -0.813599 -0.129017 0.112961 -0.088824
155 -6.134632 3.557999 0.701932 2.079911 2.066714 -1.294425 -0.173667 0.456314 -0.048396 0.187445
156 2.531021 -2.213539 0.799915 -1.817148 0.833751 -0.284596 0.232651 -1.042481 0.306955 0.005357
157 3.119524 0.608788 -0.805960 -0.171343 -0.484350 -0.768069 0.185560 0.775030 -0.347541 -0.021863
158 2.246913 -0.402010 2.620912 -0.646101 0.090222 0.347314 0.663910 -0.158578 -0.261263 0.302041
159 1.226142 -0.726337 -2.268936 -0.729221 1.316745 -0.550012 0.573434 -0.736547 -0.402052 0.256787
160 4.738588 3.105472 0.356572 1.691611 -0.145998 -0.294567 -0.646889 0.399938 0.301348 -0.075116
161 -4.064986 -1.928663 -2.515264 -0.745082 0.676094 -0.208778 -0.706024 -0.030494 0.174025 0.125087
162 0.234348 -3.084340 0.479509 -0.583409 0.421521 0.034982 -0.751965 0.096664 -0.060205 0.302066
163 3.359778 -0.544019 0.168721 0.451814 0.052006 -0.732679 0.696385 -0.409110 -0.406426 0.208339
164 -4.005191 1.109095 1.454784 -0.473173 -1.093650 0.182811 0.904125 -0.088785 0.019397 0.143230
165 -4.079158 0.748394 1.979178 -1.277561 -1.194249 0.048400 0.681107 0.631842 0.247757 0.608758
166 1.847002 -3.854362 1.030552 -1.021446 -0.039587 -1.278409 0.040685 -0.424131 0.410325 -0.131202
167 -4.217750 -0.270299 -2.294495 -1.901465 0.466679 -0.725879 -1.520094 -0.051799 0.121152 0.133035
168 2.417981 2.380065 -0.165921 2.097677 -0.586661 0.146673 0.310033 -0.167201 -0.046026 -0.009582
169 3.456024 0.977300 0.845415 -0.796853 -1.109987 -1.056208 -0.529285 1.286730 -0.820463 -0.058966
170 -3.929769 -0.465734 -0.812973 -0.303672 -0.576079 -1.151718 -1.087230 0.075330 -0.157210 0.236225
171 -4.711964 4.900020 1.267042 -0.353641 1.650202 -2.853486 0.666672 -0.226869 0.133687 0.074100
172 0.696941 -1.873600 -1.195903 -0.297749 0.057637 1.085000 0.467554 0.264950 -0.283209 -0.246185
173 -2.878330 1.578625 1.632299 -0.481854 1.777609 0.095155 0.607176 -0.550816 0.121828 -0.037463
174 -0.111378 0.461439 -0.909193 -0.683213 -1.345448 1.381227 0.328180 0.534168 0.035691 0.000330
175 1.151527 -1.248306 0.950696 2.415838 0.627955 0.482458 -0.351032 -0.020720 0.399367 -0.046147
176 0.310479 -0.825901 3.173020 -0.813977 0.875028 0.790233 0.017322 -1.219916 0.394851 -0.074550
177 1.619409 -0.775626 -1.291408 1.135888 -0.111313 0.011544 0.333523 -0.014635 -0.069083 0.229696
178 1.678113 -2.616120 1.637819 0.807350 0.273202 0.232358 -0.041376 0.474971 0.254925 -0.205983
179 2.666124 1.557735 -1.334264 0.030868 0.555101 -0.088730 0.217638 0.230345 -0.065204 -0.028711
180 -4.764218 -0.309800 1.344596 0.675387 -1.029565 0.999525 0.683518 0.189778 -0.471323 -0.682896
181 5.465703 1.790708 1.148563 -0.205691 -0.306167 0.520796 -0.455808 -0.230671 -0.227612 0.413203
182 1.608763 -2.558551 -0.991711 1.404232 0.008086 -0.933344 0.507517 0.182776 0.652798 -0.177175
183 5.628461 0.685085 0.999277 -1.196556 1.487224 1.024068 0.455201 0.457874 -0.536853 0.380130
184 -3.302758 -0.705535 -0.399104 0.222041 0.452701 0.143562 -0.944535 -0.297567 -0.254179 -0.728958
185 -0.342038 -1.606066 1.029502 1.363539 2.333281 0.214924 -0.239591 0.701894 0.208415 0.128666
186 0.335435 -2.353243 1.532834 1.197436 1.258862 0.211503 0.780309 -0.126139 0.327946 0.059110
187 0.336056 -0.263924 -1.249817 -0.646271 1.054242 -0.048015 0.304669 0.156430 -0.554921 -0.030349
188 -4.166783 0.398965 0.848872 0.415731 -0.073462 1.196079 0.010658 0.048224 -0.371671 -0.274912
189 1.606132 -1.814569 1.697829 0.470474 -0.085106 0.080422 -0.688143 -0.414276 -0.357778 -0.230035
190 -1.858561 -2.021705 -0.431959 0.165944 -0.157836 -0.516234 0.505718 -0.365631 0.014422 -0.153789
191 1.556276 -1.191112 0.570101 0.984357 -1.478860 0.890425 -0.451861 -0.014208 0.070495 -0.359486
192 1.530219 0.382977 -2.006113 -0.613567 0.867810 -0.504050 -0.201907 -0.237517 -0.085876 -0.212266
193 -5.265773 3.162469 0.007870 1.375367 0.777228 -1.868283 -0.042800 0.100568 -0.058398 0.037133
194 1.342639 -1.011040 0.894367 -0.856057 1.023861 0.179578 -0.669719 -0.524780 -0.324022 -0.034007
195 2.270131 2.490734 0.305325 -0.284289 0.061884 0.280050 0.129807 -0.004766 0.204287 -0.152259
196 -5.478200 -0.131803 -2.065876 -0.259878 1.289024 1.653747 -0.726539 0.260106 -0.117210 0.496177
197 1.779211 1.726275 1.077945 1.283563 -0.510395 0.884534 0.460463 -0.136120 0.246942 -0.190797
198 1.972979 2.783620 0.387166 0.093876 -0.674276 0.401002 0.887414 -0.410426 0.246758 -0.154549
199 2.187752 2.278520 0.345752 0.195879 0.037242 1.217583 0.446705 -0.224194 0.125047 -0.261840
200 -0.014451 0.346949 -0.558462 -0.155611 -1.239704 1.715166 -0.245659 0.543948 -0.090193 -0.034954
201 1.804182 -2.943203 1.098868 -0.784294 0.337974 -0.358047 -0.429438 -0.602130 0.034376 0.288113
202 -4.582738 0.716876 -1.687009 -2.537489 0.111549 -1.632127 -0.497362 0.103430 0.205663 0.456933
203 -4.388519 0.954559 -0.797459 -0.613519 -0.312023 0.508006 0.070613 0.232834 0.107643 0.265924
204 3.596011 -2.434172 -1.388913 -0.350878 -0.344722 -1.035463 1.053863 0.209699 -0.009457 0.121808
205 1.069249 0.036525 -0.334715 0.828824 -1.781342 -0.032712 0.644590 -0.085539 0.119748 -0.261189
206 0.150700 -0.851827 0.031462 0.885199 -0.653013 -0.163047 0.468436 -0.117310 -0.335099 0.151170
207 2.443058 3.333111 0.334285 0.399030 -0.893156 -0.286144 -0.172716 -0.025018 0.282829 -0.501975
208 1.597889 1.431510 -0.801508 0.982493 -0.378958 0.945890 0.088574 0.013889 -0.051372 -0.066419
209 -3.955722 2.050647 -0.603123 -0.132398 -1.770565 -1.272285 0.180656 -0.051500 0.177246 0.146676
210 -0.069912 -3.547597 1.540023 -0.557342 0.097941 -0.445045 -0.548207 -0.345087 0.640725 0.116673
211 3.161046 -0.712057 0.336473 0.914410 -0.830702 -0.191809 -0.814332 0.013964 0.187732 0.211297
212 1.573611 -1.115421 0.815670 1.012402 0.236447 0.691744 0.247573 0.322136 0.024311 -0.079524
213 -2.464428 1.920383 2.300945 0.000639 1.550643 -1.931829 0.991995 0.401485 0.055769 0.040898
214 3.531068 0.129383 0.255361 0.464353 -0.585244 -1.356162 -1.082588 -0.188394 -0.251030 -0.132834
215 1.192854 0.275347 2.100363 0.404429 0.175268 0.290712 -0.713325 -0.307628 -0.295925 -0.227923
216 2.009037 1.867829 -0.807675 0.717970 0.698409 -0.185959 0.169080 -0.764484 -0.136066 0.129174
217 -5.199420 0.706687 -0.857253 1.437966 -0.956392 0.207708 -0.380018 0.337924 0.029641 0.420476
218 2.073770 1.031579 -0.468383 1.226930 -1.187607 -0.223884 0.173772 -0.451705 0.043481 -0.075399
219 4.520678 -1.887612 -2.250675 -1.629679 1.093249 -0.218282 0.943892 -0.248602 -0.082399 0.422085
220 -4.934563 0.843420 -0.654769 0.545001 -2.155007 -0.316231 -0.495643 -0.226446 0.360890 0.598223
221 0.664495 0.992827 0.070006 -1.153746 -1.646199 0.561956 -0.069880 -0.107257 0.523855 -0.355911
222 -1.783121 -0.159860 -0.936100 1.190532 1.001631 -1.416084 0.698597 0.304179 0.501293 -0.063188
223 2.070105 2.296592 0.964849 0.878002 -0.280290 0.430507 0.727782 -0.313813 0.306209 -0.089024
224 3.334081 1.193776 0.304389 -0.293550 -0.018633 0.006483 0.410691 -0.096241 -0.529712 0.094015
225 1.569985 -1.923728 -0.253603 0.204191 -0.620257 -0.372209 0.068967 0.450851 0.299835 0.361912
226 -4.654700 0.266074 -2.238110 0.095218 0.331546 0.175719 -0.898622 0.213623 -0.017425 0.307851
227 3.223974 -2.400686 -0.579664 -0.422238 -0.044440 -0.364936 -1.152056 0.496206 0.122314 -0.058982
228 -4.594232 -0.501368 -0.516332 -0.701184 0.885101 1.531357 0.141157 0.156832 -0.421149 0.118484
229 2.651054 2.048094 0.107770 1.033637 0.703632 0.161796 0.065165 0.025029 -0.102025 0.043699
230 5.978738 1.516071 0.292236 0.074182 0.818226 -0.626109 0.184155 0.117359 -1.279380 0.714172
231 6.547860 2.210417 0.546237 -0.722631 2.329391 1.002883 -0.036682 1.161454 -0.056851 0.137442
232 2.718711 3.671344 -0.109744 0.247990 -0.290944 -0.354760 0.364246 -0.292664 0.652772 -0.136159
233 -3.586759 0.302708 1.363307 -0.425423 -1.028278 -0.282816 0.260930 -0.140742 -0.119188 0.209805
234 1.941031 -1.394947 -0.702539 0.402111 -0.294302 1.097594 0.283406 0.905821 -0.015781 -0.473938
235 0.401942 1.668207 0.007661 -0.636752 -2.460951 0.349607 0.559957 0.477085 0.283245 0.108390
236 1.033930 -1.992572 0.663778 2.987390 1.317246 -0.535690 -1.039960 0.485786 0.346641 -0.081809
237 2.020480 2.936252 0.386382 0.299466 -1.090060 0.031838 0.238059 0.063643 0.059363 -0.079702
238 -4.551942 0.894440 0.067263 -0.940185 -0.465584 -0.397167 0.567501 -0.258215 0.358418 0.721628
239 1.532254 1.838720 -0.446134 0.562868 -0.295650 0.783207 0.953926 -0.880838 0.225664 -0.100623
240 1.795987 -3.045739 1.312159 -0.466626 0.341696 -0.137609 -0.399307 -0.565822 0.270701 -0.021717
241 0.469551 -1.267260 -0.715703 -0.810579 0.799547 -0.240110 1.067638 -0.330256 -0.253354 0.010770
242 2.762205 2.990218 -0.764870 0.302814 0.158273 0.373867 -0.352096 0.132278 0.264556 0.112329
243 -5.006435 -0.257925 0.430731 0.931657 -1.251968 0.888900 -0.254242 0.018042 -0.089735 -0.051414
244 1.289885 2.164698 -0.250956 -0.357304 -2.070273 -0.492621 0.728134 -0.033912 0.572307 0.421394
245 2.918252 1.745938 0.470251 -1.192522 -0.257503 -0.574407 -0.076870 0.526717 -0.424731 -0.136454
246 1.473454 -2.908833 1.609227 1.728057 1.248340 0.309843 -0.549991 0.726199 0.592923 -0.321290
247 0.874443 -1.338909 2.270890 -0.069016 0.030456 -0.571578 -0.121046 -0.504212 -0.136646 0.035071
248 -4.830306 0.542537 -0.040052 0.343027 -0.573670 0.519192 0.357177 -0.022718 -0.438420 -0.630933
249 4.917467 0.074735 0.941310 -0.711226 0.529049 0.365594 -0.285894 0.144709 -0.701648 0.634546
250 3.454267 1.731566 -0.831118 -1.490809 0.225877 -0.272755 -0.968067 0.855696 -0.338504 -0.029890
251 -5.675468 0.561649 -1.340579 1.239539 -0.533803 0.490297 0.002602 0.008286 -0.404189 0.137504
252 0.982088 0.984554 0.014320 -0.922218 -1.772075 1.044226 0.124930 -0.314602 0.386327 0.081877
253 1.559644 -2.253598 -1.316321 0.617795 1.020550 0.064778 0.955349 0.294143 -0.303435 -0.116090
254 0.042311 0.420690 -0.442496 0.458641 -2.202275 1.068158 -0.456995 0.629590 0.207348 -0.537754
255 -4.496300 -0.345280 -0.266573 -3.127142 1.235034 0.279745 -0.488219 0.321330 0.066462 -0.552625
256 2.160945 -1.912924 0.604830 -1.042074 0.760403 -0.977775 -0.665901 -0.645284 0.144201 0.103861
257 1.385055 -1.963474 -0.856865 -1.731800 1.078894 -0.283671 1.093528 -0.344249 -0.080042 0.159715
258 -2.929029 0.252719 -0.665396 0.317167 -0.014943 -0.254052 -1.054026 -0.533029 0.140837 -0.436670
259 -5.174341 0.965793 -1.356024 0.737703 -1.428150 0.133348 -0.299046 -0.352163 0.356507 0.967658
260 4.994804 2.316859 0.870548 0.117985 0.667574 -0.188895 0.050951 0.217695 -0.133380 0.271608
261 -0.001718 -1.227911 2.125825 0.307261 -0.344909 0.136841 -0.717446 -0.538256 -0.027475 -0.364719
262 4.024691 -1.212162 -1.272166 -0.904182 0.285864 -0.569340 0.921103 0.119591 -0.644452 0.254095
263 3.940740 -3.045205 0.783799 -0.916374 -0.183252 -0.655577 0.348919 0.212422 0.204765 -0.013475
264 -2.591912 -2.357104 -1.552573 -1.196504 0.164477 -0.665609 -0.063635 -0.235400 0.100569 0.143737
265 2.261626 2.325694 0.629693 -0.097337 -0.663617 0.404004 0.784482 -0.496936 0.279064 0.097965
266 2.677890 3.538482 -0.252048 0.102469 -0.009348 -0.595650 0.088995 0.047652 0.363309 -0.210097
267 -0.780262 -2.408897 -1.596388 -0.894149 0.447184 -0.339410 0.309105 0.093604 -0.041069 0.043491
268 3.922178 -3.032988 -1.002082 -0.343416 -0.245657 -0.612832 0.993993 -0.072729 -0.040178 0.205560
269 5.150178 1.985458 0.640241 0.154096 -0.814486 -0.695222 -0.266933 0.172196 -0.246914 -0.014595
270 2.228676 2.141714 -0.816986 2.401313 0.479364 0.854722 0.201855 -0.209895 -0.041007 0.217405
271 -1.089856 -1.342231 -0.223933 1.954447 -0.417378 -0.882927 0.804949 -0.537513 -0.352962 -0.279028
272 0.860003 -2.565510 1.145824 -0.784987 -1.379281 0.167183 1.103343 0.300106 0.355471 0.309106
273 0.678389 -2.592709 -0.688995 -0.133256 -0.761332 -0.437285 0.614547 0.517666 0.128248 0.003853
274 -6.093604 4.213963 1.910958 -0.639977 0.389772 -1.657538 0.166169 0.084148 0.280503 0.349407
275 1.401987 -1.652397 -1.225974 2.516385 0.580386 0.711508 0.510057 -0.062946 0.072258 0.033827
276 2.059547 1.408358 -1.351656 0.534796 0.097203 -0.226213 0.581962 -0.693755 0.116744 0.141341
277 3.462216 1.714404 -0.276666 0.128971 -0.843564 -0.458749 -0.140060 -0.198752 -0.737211 0.063219
278 -5.293122 -0.998544 0.530360 -1.022785 0.404895 1.726073 0.162205 0.574561 -0.534847 0.070252
279 1.598115 -2.975392 0.501042 1.759960 0.390874 -0.222536 -0.762224 0.325543 0.282649 -0.145864
280 -1.193590 -1.149117 0.372136 1.139160 -0.458152 -1.674757 -0.928811 -0.114099 -0.169188 0.432485
281 1.916645 0.902776 0.132717 0.993917 0.022647 0.873791 -0.014159 -0.427400 0.274165 0.234661
282 2.044720 2.940528 -0.497764 -0.246952 0.464668 0.492384 0.553920 -0.065511 0.063700 -0.137264
283 -5.819002 -1.658303 -0.453597 -1.685918 0.909966 1.459549 -0.317237 0.832476 -0.607443 -0.497730
284 1.022724 1.905694 -0.183983 -1.714627 -1.265480 0.316177 0.444779 0.219235 0.513738 -0.023322
285 -0.569971 -1.458145 -1.023387 0.766437 -0.241793 -0.246843 0.725051 -0.891767 -0.119428 0.183037
286 2.347593 -0.377232 0.254687 0.825946 -0.188658 0.578245 0.110861 -0.323180 0.165666 0.451312
287 0.957372 0.417827 -1.008861 -0.534550 -1.632500 -0.184467 -0.864165 -0.559673 0.148651 -0.225185
288 -2.867653 0.103048 -0.179272 1.335158 0.047048 0.550932 -1.317224 -0.676537 -0.112461 -0.421508
289 4.029398 1.880769 -0.471933 -0.690639 2.017369 1.679182 -0.985434 0.557244 0.071091 -0.072366
290 3.318293 -0.611297 0.385792 -0.714972 -0.379533 -1.182513 -0.183550 1.100759 -0.503833 0.240666
291 -0.323197 0.321538 -0.075870 0.191823 0.287254 1.359787 -0.041748 -0.558368 -1.087479 0.472763
292 1.711479 0.254541 0.367426 1.042966 1.104984 0.249085 0.168778 -0.202526 0.343133 -0.023997
293 3.224687 -1.778821 1.491084 -1.304341 -0.448771 -0.088262 0.264514 0.812565 -0.078226 0.172180
294 -5.035765 4.173021 0.169513 -0.762574 1.949918 -1.869343 0.262690 0.063314 0.136980 -0.301856
295 2.042275 -2.096128 0.045853 1.463460 -0.486456 -1.292755 -0.496403 -0.284882 0.229980 -0.028524
296 -2.444622 0.252192 -0.343033 2.336876 1.193115 -0.402041 1.203340 0.232379 0.107697 -0.098713
297 4.210904 0.991352 -1.454296 -1.645333 1.063908 0.429585 -0.877723 -0.941683 -0.336297 0.372639
298 -0.692933 -2.422197 1.715802 -1.254565 0.800241 1.269858 -0.055134 -0.827448 0.155094 -0.500166
299 0.321908 -1.494952 1.210904 0.193067 1.155458 -1.151507 -0.004495 0.493397 0.846105 -0.082148
300 -4.287758 0.656367 0.232725 -0.888401 0.047766 0.112995 0.333090 0.458694 -0.007212 -0.007069
301 1.130495 -0.736451 -1.973215 -0.557628 1.191309 -0.416821 -0.108966 -0.524316 -0.268155 -0.168660
302 1.318940 -2.857071 1.327745 2.085759 0.775116 -0.181295 -0.302658 0.653035 0.656703 -0.091005
303 3.070705 -3.512532 0.304543 -0.913926 -0.175445 -0.403321 0.344447 0.092432 0.449112 0.177164
304 1.996653 2.367546 -0.248305 0.602388 -1.090424 -0.025415 0.195382 -0.117739 0.035189 -0.245657
305 1.695211 0.041285 -1.055733 1.070651 0.090451 -0.302188 0.582284 -0.461280 0.030668 0.180636
306 -3.824945 -0.742733 1.538664 -0.953539 0.042523 0.092361 -0.145682 0.162396 -0.228923 -0.553993
307 -3.842732 -0.079131 -0.589360 -0.697040 -0.884834 -1.370612 -0.801463 -0.043028 -0.265479 0.449179
308 -2.973580 -1.440715 -2.150048 -1.063094 0.331880 -0.910448 -0.281855 0.147252 -0.479717 -0.252236
309 -3.840000 -2.198461 1.270378 -1.606331 0.565662 0.323197 -0.193619 0.455051 -0.179384 0.116870
310 -1.954379 -0.287860 0.033091 -0.289253 -0.641026 0.578635 0.997643 -0.845028 -0.020468 -0.510152
311 0.382985 0.838786 0.865513 -0.886947 -1.711355 0.239539 0.581583 0.400447 0.004267 -0.565578
312 2.238200 -0.177454 0.617076 0.441448 0.067084 0.850850 0.192805 -0.499621 0.202340 0.292793
313 -3.795936 -0.947455 -0.493359 -0.130505 0.777223 1.202532 0.725366 -0.810262 -0.318616 -0.100946
314 2.436664 2.652819 1.104200 0.087964 -0.648048 -0.265519 0.191558 0.586500 -0.139648 -0.218961
315 3.532680 2.160466 -0.776694 -1.254610 -0.132274 -0.941186 -0.075182 0.716090 -0.342033 -0.027510
316 3.005122 -0.125571 -0.287200 -0.531330 -1.268108 -0.433261 0.307722 0.704473 -0.112842 -0.283303
317 -2.184467 -3.124563 1.438946 -1.139088 0.029581 0.797774 0.198031 -0.489778 0.470390 -0.047756
318 5.321719 2.402490 -0.500503 -0.122925 0.573747 -0.483499 -0.344908 0.861325 -0.354701 -0.139530
319 -3.420328 2.386199 0.118180 0.917832 1.647299 -1.183588 -0.007409 0.203303 0.388125 0.436965
320 -4.870778 0.148559 0.747852 1.470725 -0.758055 0.096988 -0.234694 0.618067 0.076812 0.435400
321 -6.927441 4.297220 0.866329 -0.658563 2.513997 -0.872049 0.421678 0.387917 -0.094895 -0.026123
322 2.540740 3.136172 -0.621792 0.144602 -0.390158 0.024506 -0.546327 0.320639 0.443518 -0.304409
323 -2.840583 -0.476577 -1.876700 0.658004 -0.101450 0.162249 -0.017051 -0.565346 -0.397313 -0.539091
324 0.437031 -2.148478 2.334204 -0.505086 0.457542 -0.448070 -0.038561 -0.328167 0.001113 -0.163422
325 2.625092 3.265211 -0.284906 0.344060 -0.780841 -0.322472 0.315347 -0.322192 0.134441 0.057662
326 -2.511864 -3.025274 -1.919394 -2.004592 1.180873 0.056682 0.180692 0.160475 0.119165 -0.112703
327 1.791936 0.301198 -0.390216 -1.247994 0.496971 -0.434934 0.720745 -0.657036 -0.521862 0.275339
328 0.827344 -2.635451 0.459446 0.222175 -1.008356 0.291139 0.285029 0.343057 0.123793 0.053981
329 1.501718 -0.715325 1.027225 -0.067612 0.578401 -0.478243 -0.652097 -0.475191 0.464904 -0.131081
330 1.073146 -2.816883 -3.161907 -1.069947 1.140140 -0.061416 0.434353 0.246893 0.030966 -0.200945
331 -2.679717 -0.580923 -1.346043 -0.730668 0.244389 -0.651758 0.351040 0.022598 -0.353213 -0.082748
332 -5.646147 0.059147 0.021700 -0.539343 -0.073106 1.467713 0.727177 -0.453589 -0.012839 0.203986
333 2.737714 3.235269 0.439325 0.254192 -0.473471 -0.363621 -0.152849 0.210832 0.349801 -0.402272
334 -5.009511 2.670722 0.108357 -0.272791 0.949886 -1.540226 0.505484 0.114529 -0.012071 0.457994
335 -5.172551 0.258697 -0.127834 -0.240286 -0.608670 -0.090839 -0.182467 0.607177 -0.062327 0.305078
336 1.308128 1.325221 -1.077877 -1.831557 -0.552640 0.461195 -0.112768 -0.077804 0.517992 -0.097810
337 -2.643352 1.248842 1.072327 0.115047 2.018977 0.125390 1.375299 0.168272 0.048888 -0.049513
338 0.161813 -2.405315 -1.577002 -2.100553 0.650788 1.269042 0.278144 0.163416 0.029101 -0.404919
339 1.945520 -0.229994 0.205989 1.060513 -0.069623 -0.055362 -0.176437 -0.125187 0.260417 0.011148
340 2.160510 -0.703160 0.264312 0.641425 0.134176 -0.194158 -0.196122 0.048343 0.264182 -0.087605
341 2.823435 0.508490 1.136307 0.233693 0.003725 0.807796 0.370128 -0.143202 -0.793253 0.036599
342 4.627115 2.482786 0.552838 1.436781 0.810688 0.060801 -0.459630 0.407196 0.255218 0.101726
343 -4.394279 0.638198 -1.368452 -0.969723 0.309128 -0.624344 -0.296201 -0.379895 0.517067 0.682245
344 -5.069418 0.601691 -0.213828 0.030208 0.485396 1.437502 0.184017 -0.020817 0.443088 0.764103
345 -4.828275 3.395977 0.657976 0.042335 1.051494 -1.013039 0.533258 -0.481405 0.241509 -0.378604
346 -5.481944 -1.749626 0.557523 -0.771510 -0.349269 0.266118 -0.157081 1.056955 -0.794026 -0.730388
347 1.092149 -2.473355 -0.733996 -0.371471 0.714994 -0.798944 1.627673 -0.686494 0.370024 -0.175622
348 0.781052 -2.524451 -1.703714 -0.703485 -0.592417 -0.174039 0.208262 0.144338 0.193019 -0.344569
349 2.768927 -3.141007 -2.063487 -1.250292 1.336757 -0.822431 0.955500 -0.523742 0.266979 0.101644
350 -2.151876 -1.487336 2.385003 0.182881 0.037311 0.665264 0.305051 -0.170835 -0.487957 0.298848
351 3.390698 2.764370 -1.026128 0.581456 1.711494 0.169389 -1.084389 0.304093 0.433006 -0.096994
352 0.775923 -0.337062 -1.707129 -0.948499 -0.079650 0.833461 0.726716 -0.113036 -0.079876 -0.407662
353 1.817713 1.666012 -1.069451 1.605741 -0.150323 0.290282 0.692420 -0.713017 -0.129766 0.229313
354 -1.657449 -1.122089 -1.802068 0.228342 -0.026808 -0.420161 0.076599 -0.394117 -0.350686 0.028662
355 -0.809851 -0.545153 0.718231 0.324911 -0.561362 -0.158105 -1.034305 -0.589244 0.093636 -0.277078
356 0.935048 -1.464936 -2.017577 0.949514 0.885423 0.437267 0.285639 -0.089759 0.173062 -0.137332
357 -4.120119 -0.579259 0.616603 -2.237392 0.996099 0.494555 0.063851 0.231901 -0.279820 -0.686784
358 0.993302 -0.158743 -0.426097 0.877296 -0.916928 -0.709342 0.127040 -0.695620 -0.017913 -0.189039
359 -2.253496 -2.164693 -0.397989 0.662059 -0.638206 -1.169121 0.063967 -0.262438 -0.202318 0.297336
360 -4.723110 0.265437 0.460611 -2.524727 -0.428064 0.153830 0.167605 0.370216 0.206691 -0.411027
361 -2.997572 -1.595973 1.919753 -1.741969 0.197587 0.830371 0.383852 -0.210481 -0.285761 -0.463113
362 -0.254062 -0.398422 -0.542851 0.550181 -0.217213 -1.159745 0.536486 -0.318180 -0.445679 0.118532
363 0.648877 0.546302 -1.773377 -1.143815 -0.467638 0.672968 -0.025147 -0.417233 0.272686 -0.443494
364 1.385971 1.209407 -0.946272 -0.942803 1.128735 1.005906 0.049992 -0.539022 -0.117614 0.163903
365 -4.258453 -0.220433 -2.028797 -0.435298 -0.154899 -0.246284 -0.231349 0.013903 -0.617315 -0.547634
366 0.512037 0.777700 -0.471458 0.447001 -1.940121 -0.026402 0.154273 0.050359 0.161322 -0.511952
367 4.026888 1.709515 0.642882 -0.536014 1.000328 2.241301 -0.598455 0.252750 0.158641 0.031574
368 2.231839 1.468756 -0.838064 1.483237 0.014785 0.243573 0.228095 -0.357259 -0.338947 0.247964
369 0.313484 0.768191 -0.392540 -0.763377 0.047677 0.250783 0.690793 -0.599597 -0.203635 -0.234898
370 0.343608 -0.763933 0.925781 1.904605 0.974127 -1.733495 -0.420212 0.169852 0.690074 -0.129928
371 0.193195 -1.629330 -0.701935 1.774936 1.397081 -0.009729 0.796474 0.555116 0.015715 -0.135176
372 -0.152825 -1.177974 0.178709 0.458382 -1.110905 -0.135967 0.551031 0.426910 -0.343258 -0.498563
373 -0.662757 -2.131700 0.009351 1.552251 1.170143 0.539671 1.085636 0.504730 0.191494 -0.042264
374 5.492378 2.348763 0.282465 -0.200285 1.440062 0.689024 -0.197951 0.999598 -0.184894 -0.092641
375 -4.002352 2.758473 2.202483 0.982467 1.748421 -1.787440 0.647763 0.724520 -0.178182 -0.138303
376 -4.406124 -0.071822 -0.313674 -2.021898 0.696207 0.487628 -0.377554 -0.199440 0.436952 -0.201934
377 4.187489 0.101646 1.004567 0.056522 -0.333636 -0.504750 0.017789 0.217649 -0.512657 0.311178
378 5.151249 1.990009 0.482045 0.091413 -0.878494 -0.639004 -0.823913 0.029552 -0.164808 0.281947
379 -4.778373 0.254271 0.582990 0.234575 -1.065066 0.237586 0.420942 0.627779 -0.027190 0.177643
380 4.289219 2.261063 0.608347 0.788672 -0.698659 -0.431401 -0.348107 -0.235552 0.175907 0.254673
381 -5.952207 2.653678 0.889893 2.137270 2.419149 -0.828867 0.335378 -0.669038 -1.576314 0.683427
382 1.748679 2.179537 0.603900 0.922789 -0.700534 0.670976 0.873654 -0.295756 0.230193 -0.181278
383 -4.497466 -0.163072 0.677130 0.608240 0.432163 0.474312 -0.185290 -0.405000 0.044232 -0.005271
384 2.012688 -0.245057 -0.088602 -1.097503 -0.476706 0.209141 0.870934 -0.221140 -0.477170 0.079669
385 -0.208259 1.046273 -1.386567 0.864490 -1.543160 0.376148 -0.070765 0.293349 -0.283076 -0.463179
386 -1.317642 -0.991899 0.510588 0.231032 0.566108 -0.442152 -0.710335 -0.210857 -0.166186 0.101638
387 0.780147 0.618517 -1.051413 0.097639 -1.439247 -0.397779 0.316534 -0.162071 0.054373 -0.290475
388 0.233327 0.113410 -1.440274 -0.464045 0.287371 0.527450 0.346167 0.005806 -0.267933 -0.177521
389 -5.295634 0.671140 0.285034 -0.308234 -0.765971 0.542933 0.214736 -0.106189 0.362754 0.817448
390 2.720402 3.366677 0.748861 -1.033229 -0.614486 -0.084054 -0.012739 0.207337 0.477562 -0.439512
391 2.396542 -1.968671 0.071977 0.539747 -0.396037 0.227352 -0.366598 0.386138 0.053194 0.266129
392 0.374006 -2.070909 -0.513721 -0.744872 -0.610953 0.944934 -0.009031 0.230203 0.301603 0.316390
393 1.081408 0.344062 -1.093741 1.650252 0.467013 0.564285 0.621178 -0.333042 0.026320 -0.040914
394 -1.050072 0.436651 -0.416213 1.764637 -0.468912 -0.714045 0.905226 -0.794979 -0.433557 -0.254907
395 1.441504 -0.101346 0.485602 1.075909 -0.412682 -1.450648 -1.757277 0.209749 -0.227358 -0.120119
396 -5.456283 4.916527 0.010116 -0.186895 2.689074 -2.518780 -0.657944 -0.477492 0.414305 -0.423785
397 1.961146 -0.161736 -0.105018 2.001315 0.346791 -0.635636 -0.252367 -0.197924 -0.117908 0.179916
398 0.856142 -2.423987 1.247567 1.133086 1.222091 -0.443275 -0.236288 0.907017 0.757875 0.008932
399 2.454983 -1.523788 -1.718300 0.375763 -1.102210 0.180432 -0.148363 -0.000387 0.174356 -0.064805
400 -4.454763 -1.740902 0.267238 -0.753850 -0.816552 0.359084 0.039819 0.310509 -0.272921 -0.247068
401 2.169546 -1.085845 1.207041 -0.706052 0.233388 0.212357 -0.572337 -0.859254 0.158987 -0.183348
402 -3.481185 1.572093 -0.686621 -1.768994 0.123371 -0.749767 -0.359903 -0.508166 0.378801 0.010940
403 1.778505 -3.293714 -2.175927 -0.960632 0.652250 -0.493541 -0.230805 0.290955 0.454769 0.500796
404 -3.240454 -1.514904 0.487675 -1.212346 -0.518074 0.401512 -0.857933 0.090994 0.102733 0.291900
405 1.605310 -1.906359 1.115491 0.991963 0.182160 0.534188 0.444890 0.100270 0.274386 -0.087177
406 4.080386 1.171855 1.741891 -0.213975 -0.893462 1.108173 -0.409713 -0.182293 -0.237491 0.145411
407 2.942782 0.431951 0.624886 -0.111706 -0.394755 -1.582452 -0.279056 -0.303402 -0.813328 0.069304
408 1.681731 -0.158046 -0.680972 1.171189 -0.178314 0.408231 0.540869 -0.132828 0.084468 0.034151
409 0.653517 -1.310194 2.433232 -0.489047 -0.457075 0.258828 -0.486372 -0.852865 0.343126 0.076287
410 0.064005 -1.413022 -0.868780 1.035221 -0.785761 -0.373048 0.112428 -0.544149 0.100854 0.144967
411 6.001905 2.672181 1.129430 0.656335 0.101019 0.150346 0.043458 0.215523 -0.081753 0.196505
412 2.331196 2.502414 0.269596 0.176836 -0.086283 1.089064 0.294325 -0.406383 0.315256 0.041418
413 2.896361 -2.360108 2.375282 -0.776083 0.736821 0.701547 0.478476 -0.141479 -0.328132 -0.149495
414 0.819502 1.225185 -0.207614 -1.882991 -1.073777 1.336062 0.079571 -0.317304 0.658123 -0.004154
415 -4.188421 -0.138578 0.954283 -1.835433 -1.497256 -0.475497 0.213072 -0.194500 0.383205 0.432690
416 1.945652 -1.264388 -0.882252 0.256999 0.608725 0.265496 1.034357 -0.148554 -0.427952 0.175277
417 1.749287 -3.122543 1.543449 1.551726 0.775711 -0.352070 -0.230937 0.786125 0.417331 -0.423975
418 1.448124 0.737081 -0.080213 1.704440 0.439250 1.713623 -0.176659 0.229341 -0.195625 0.215967
419 3.483773 -2.077950 1.119732 -1.158327 0.253323 -0.700366 -0.138824 -0.087256 -0.826278 0.071634
420 3.960883 3.087946 -0.688338 -0.281465 0.181027 -1.150340 -0.672048 1.414144 -0.025428 -0.314142
421 -3.119851 0.131277 -0.021037 0.152544 -0.606289 -0.530738 -1.087081 -0.672245 0.229824 -0.263195
422 3.210762 -3.321804 0.226990 0.489090 -0.317899 -1.991951 -0.408369 -0.323462 0.195536 0.043362
423 2.320282 2.927519 -0.922735 -0.293106 -0.110898 -0.185097 0.207071 -0.290782 0.198141 -0.225602
424 -0.798948 -1.858165 0.782521 -0.691642 1.011432 0.979194 -0.812737 -0.973353 0.167020 0.096137
425 3.357027 -2.072119 2.366709 -1.558828 0.021173 0.321173 0.696998 0.207872 -0.246526 -0.073217
426 -4.792024 0.228700 0.263117 -1.006564 0.222727 0.740158 -0.075364 0.348216 -0.048416 0.223527
427 0.575172 -1.794656 1.968752 -1.480976 0.311630 0.770272 -0.197044 -1.108654 0.355505 -0.290317
428 -4.093703 -0.914927 -0.344199 -2.374369 0.729953 0.023609 -0.716665 0.434063 -0.283852 0.046625
429 2.878031 -1.779090 -0.968944 -0.615386 0.011126 0.455872 -0.440314 -0.516828 0.642367 -0.118235
430 -4.548045 -0.193083 0.292840 0.379567 -1.592053 -0.909069 -0.177310 -0.157447 -0.354209 0.156825
431 -2.569761 0.284908 0.917072 2.816282 2.091160 0.227432 -0.397571 0.291562 0.297755 -0.056656
432 2.422315 0.659250 1.832438 -1.485510 0.302045 0.483623 0.025522 -0.767903 -0.082491 -0.256317
433 2.278552 2.543870 -0.182033 -0.716828 0.491550 0.642787 0.010929 -0.146292 0.364945 -0.163142
434 -3.625834 0.966617 0.166240 -1.835895 -0.107076 -0.479753 0.250384 -0.139123 -0.109531 -0.404635
435 3.733354 -2.163953 0.624956 0.011805 -0.087197 -0.575652 0.388682 -0.223860 0.058587 0.405698
436 3.083704 1.840094 -1.313964 -2.100850 1.043297 0.081396 -0.058488 0.572256 -0.179210 0.056667
437 2.807428 2.364883 -1.181883 -0.464331 0.606884 -0.029604 -0.926194 -0.725736 0.249740 -0.151600
438 -1.311976 -0.550815 -0.957385 0.741524 -0.011427 -0.246330 0.545856 -0.850535 -0.192301 0.126353
439 -2.940288 -2.432312 2.246781 -1.374746 -1.220610 -0.018168 0.185752 -0.536907 -0.136944 0.239041
440 -3.084046 -0.523982 0.171315 0.420277 -1.318434 -1.002950 0.564423 -0.171314 -0.416516 -0.509229
441 0.639318 1.551694 -1.426583 -1.031154 -0.867618 0.802942 -0.338691 0.097396 0.482997 -0.135734
442 4.654110 -1.316777 0.131192 -0.909653 0.123503 -0.663505 0.205515 0.621042 -0.437127 0.395767
443 -2.477689 -1.293854 -1.213007 -0.360058 0.311888 0.323810 0.020754 -0.193854 -0.046245 0.161442
444 -5.328604 2.768707 1.526585 2.238230 3.061031 0.898899 0.390113 0.124584 -0.116994 0.049079
445 1.052960 1.698477 -1.823219 -0.532220 -0.247893 0.507717 -0.134647 0.182636 0.716058 0.136009
446 -2.914256 -0.977661 -1.173783 -0.993620 0.710478 0.354895 0.476225 -0.244278 -0.205092 -0.041692
447 -4.632107 0.778659 -0.310609 2.792878 -1.142493 0.858639 0.070081 -0.198940 0.034607 0.412909
448 -3.109939 1.056604 0.403281 1.196297 1.247039 -0.362451 0.872612 0.415918 0.299275 -0.154932
449 1.413188 -1.764775 -1.361986 -0.288099 0.156995 1.323958 -0.983223 -0.139261 0.047494 -0.370620
450 0.336906 -1.083850 -1.039329 1.934277 0.705061 1.395847 0.513067 0.270434 0.037594 -0.293541
451 1.446046 -2.466567 -0.020008 -0.069066 0.497561 -1.568322 -0.601490 -0.356878 0.234396 0.350304
452 0.907652 -2.988007 1.375674 -1.136320 0.311717 0.459016 -0.129441 -0.148440 0.280037 0.227994
453 1.534135 -1.393179 -1.135226 0.621975 0.702275 -0.573815 0.515097 0.268977 -0.285652 -0.045944
454 -3.750610 -1.300957 -0.487034 0.733847 -1.235151 -0.875200 -0.398435 0.111523 -0.503706 -0.189032
455 2.431694 2.520588 0.836281 1.036959 -0.565161 0.919784 0.233099 0.026235 0.352664 -0.048150
456 2.821263 2.230160 0.489433 -0.743860 -0.116806 -0.423971 0.695038 0.628941 -0.496361 -0.296992
457 1.671929 -0.775996 -1.716421 0.931801 0.036703 1.004275 0.374538 -0.547162 0.332329 -0.194027
458 -5.324407 0.790822 -1.853938 1.021416 -0.186055 0.692321 -0.175896 -0.118607 -0.205742 -0.210858
459 -0.660272 -3.031041 0.230877 0.076018 -0.494783 -1.413352 -0.589461 -0.267424 0.231216 0.355619
460 2.923100 -2.899249 -2.079897 -0.607256 0.826861 -0.760410 1.181437 -0.078841 -0.020145 0.307073
461 -3.681840 -1.006930 -0.087280 -0.413637 0.777918 -0.359671 0.412007 0.048381 -0.469773 0.012796
462 -0.498419 -0.626934 -1.615028 0.405815 0.604363 -0.142735 -0.166668 0.005462 -0.047075 -0.072782
463 3.282137 3.475097 -0.779046 -0.465245 1.873182 -0.538239 -0.431404 -0.365411 0.669278 -0.208459
464 -1.765958 -1.026453 0.263777 1.925438 0.981151 -0.151473 1.059548 0.773077 0.274963 -0.227392
465 1.990316 1.517300 -0.208156 1.197674 0.264786 1.645083 -0.143353 -0.281630 0.003652 0.186630
466 2.300597 1.585767 0.517403 1.277735 -1.019739 1.222822 0.080563 -0.480125 0.121729 0.268590
467 -3.994041 1.569418 -0.274750 -1.725738 0.247027 0.806919 0.695805 -0.481826 0.614503 0.233120
468 -4.685956 -0.003614 -0.330144 -1.045410 0.396124 0.253828 -0.760109 -0.088529 0.353129 -0.024260
469 2.974552 -3.350764 -2.424804 -0.900359 0.266921 -0.937770 0.664784 0.184047 0.408297 -0.183858
470 2.225192 0.024442 -0.036903 1.004058 -0.730167 -0.033196 0.644721 0.628734 -0.412445 0.014325
471 -5.602071 -0.925325 -0.051094 -0.316036 -0.524829 1.105037 0.256211 -0.037877 -0.241674 0.008668
472 -3.177347 3.292581 1.273335 0.393392 1.894215 -2.104064 0.272225 0.290998 0.199348 0.106522
473 -5.239306 0.763656 -2.257940 -0.682475 0.264482 -0.319716 -0.618103 0.070434 0.314540 0.525477
474 2.494248 1.477235 -0.443207 -0.674024 0.312470 0.537059 -0.972404 -1.040414 0.056778 0.181185
475 -4.390742 0.494877 1.236684 1.376830 -0.442749 1.391974 0.834431 0.093699 -0.135017 0.194260
476 -4.744367 0.904201 -0.373704 -0.906508 -1.808254 -0.487595 -0.361031 -0.127020 0.570889 0.601674
477 0.407722 0.513207 -0.753807 0.015200 -1.671157 0.885029 -0.103941 0.194152 0.328499 0.209861
478 -1.341373 -1.120247 0.734734 2.071504 1.523329 0.025252 0.310241 -0.267299 0.090949 0.105031
479 2.970214 3.616865 0.214273 0.728755 -0.433201 -0.724639 -0.062795 0.352274 0.439593 -0.304761
480 -4.368163 1.205284 -0.548675 1.592318 -1.135495 -0.475631 -0.207259 0.401322 -0.138618 0.193560
481 -4.316679 0.369667 0.712375 0.335459 -0.547892 0.852486 -0.137277 0.858541 0.257478 0.532826
482 -0.329278 -0.770477 -0.795266 -0.540919 0.757338 0.505538 0.455524 -0.365410 -0.446363 -0.048810
483 2.837525 -0.515025 0.183740 -0.179251 -0.365290 -0.169895 -0.591216 -0.425238 0.146348 -0.184637
484 0.390570 1.190092 -0.955884 0.354787 -2.209017 0.053570 -0.061960 0.229401 0.296597 -0.066064
485 1.533774 1.907417 0.073694 2.089916 0.081667 1.526887 0.675764 -0.013003 -0.129313 -0.130627
486 -5.505978 0.346085 -1.153170 0.496489 -0.206920 1.644827 -0.534798 0.374949 0.024774 0.607607
487 0.165779 -0.758568 -0.925171 0.083853 0.906369 0.386105 0.469080 -0.185205 -0.097528 -0.192731
488 2.455363 0.809553 0.410439 -1.541831 0.556833 0.353405 -0.589648 -1.365681 -0.211458 0.395596
489 -3.788404 -0.629054 0.647166 -1.375340 -0.260049 -0.532057 -0.025533 -0.419083 -0.013231 0.442903
490 -5.064575 0.184942 -0.166522 -2.128552 0.039992 0.053506 0.237715 0.219313 0.061260 0.142609
491 0.021866 -2.383223 -1.725999 -1.498119 0.777822 0.035351 0.334105 -0.048590 0.060281 0.109640
492 2.613741 3.153709 0.296450 0.508176 0.112279 0.068384 0.039767 0.235761 0.515959 -0.160158
493 -4.161642 1.293972 0.299858 -0.905240 -0.696233 -0.596736 0.564899 -0.020159 0.057521 0.312630
494 -4.895918 4.846077 -0.521965 -0.712343 2.233247 -2.593811 -0.163950 -0.638857 0.183494 0.093138
495 0.578909 -0.994574 -0.714028 1.767553 0.591348 -0.022326 0.648042 0.190299 -0.371323 -0.217197
496 -4.511226 -0.858713 1.153731 0.184064 -0.944210 1.219207 0.718152 0.770144 -0.677198 -0.116423
497 1.146797 0.552762 -0.044640 -0.512397 -1.852338 -0.973006 -0.384151 0.289328 0.253908 -0.422570
498 5.508106 1.423462 0.330586 -0.227972 1.114217 -0.056033 0.255292 0.465604 -1.404528 0.849379
499 -4.090238 1.149293 1.907018 -1.466917 -1.270098 -0.585629 1.469253 0.238818 0.074150 0.024816
500 -5.007093 0.895447 0.387725 0.485120 -1.839065 -0.294937 -0.165462 0.188446 0.459324 0.660488
501 -4.336023 1.441708 0.053644 -0.434138 -0.458637 -0.874308 0.112224 0.317404 0.261421 0.110564
502 3.984500 0.862857 1.501159 -1.160910 -0.182546 1.049521 -0.377227 0.320457 -0.326105 -0.175510
503 2.661823 1.179436 0.493940 -1.201746 0.656725 0.137451 -0.489343 0.146869 -0.078679 -0.227197
504 -2.403526 -0.455230 1.072235 1.251492 -0.694877 0.189133 -0.675851 -0.320133 -0.353958 -0.408375
505 -5.064464 -0.004982 -0.274270 -0.022289 -0.276397 -0.471115 -0.617715 1.095576 -0.318755 -0.098681
506 -4.236624 -1.218805 2.501625 -1.297501 -1.282726 0.178834 0.621005 -0.263717 -0.237371 0.058522
507 2.088840 -1.656875 2.534150 -0.928670 0.038928 0.410988 -0.308487 0.126255 -0.528913 -0.346212
508 -0.352908 -0.799456 -0.038369 -0.995958 -1.122773 1.160072 0.088514 0.395618 0.112141 -0.199628
509 -4.422897 1.252207 -0.021778 -1.673147 0.225510 0.893212 0.774658 0.001477 0.208007 0.230327
510 2.657386 3.348835 -0.029011 0.103116 0.207353 0.189439 0.026626 0.266579 0.347677 -0.167420
511 1.780593 -0.911494 1.007413 0.136686 -0.232838 -1.539433 -0.489082 -0.870686 0.108408 0.099798
512 -4.726962 0.347284 1.904010 -1.229630 -1.499042 -0.362513 0.627554 0.160139 0.157665 0.462581
513 1.176995 -3.189768 2.450690 -1.727421 0.164225 0.725198 0.184120 0.440423 0.088747 0.201568
514 3.176628 -0.220937 -0.242188 -0.173828 0.168834 -0.362273 -0.703762 -0.013685 0.012596 0.073565
515 4.735208 2.897523 2.019342 0.625097 0.023121 0.893649 0.167491 -0.011749 0.442829 -0.109664
516 1.126144 -3.555226 -0.599518 -0.255783 -0.094351 -1.121142 1.000431 -0.163570 0.510474 -0.371349
517 -5.619967 -1.147091 -0.372305 -0.994274 0.225796 1.603708 -0.036334 0.201064 -0.299747 0.061448
518 2.426676 1.553577 0.584072 -0.627247 0.258360 0.273004 -0.335288 -0.595187 -0.122770 -0.082703
519 2.562594 -3.287543 -0.312958 0.266811 -0.757810 -0.945510 0.163552 -0.150930 0.599531 0.098879
520 0.183957 -0.377813 1.059974 -0.626418 0.547133 -0.197117 -0.797445 -1.130370 0.152822 -0.109394
521 3.097253 0.655206 0.005070 0.956478 -0.543769 -1.361589 -0.471498 0.482357 -0.547419 0.158195
522 2.585849 -2.360564 2.952075 -0.442592 0.438967 0.666416 0.800579 0.197688 -0.290679 0.041714
523 0.431326 -0.290180 -0.045104 0.807694 -0.172677 0.359751 -0.443340 -0.458009 -0.787250 -0.030022
524 -4.484152 -0.854206 1.182353 -0.337652 -1.363490 -0.662035 0.129783 0.108317 -0.187413 0.249408
525 0.687533 -0.009060 -0.482802 -0.385674 0.306486 -0.567761 0.460783 -0.366854 -0.265166 0.152609
526 -1.778779 -0.584416 -0.783481 -0.227602 1.479957 0.771732 -1.289955 -0.532336 0.192145 -0.217110
527 -3.479603 -1.039201 -0.107039 -2.182553 0.209602 -0.301287 -0.533183 0.173755 -0.316031 0.009787
528 -0.646467 -2.315952 -0.300116 0.675471 1.132395 0.795015 1.269826 0.490214 0.582924 -0.103162
529 2.683870 3.386572 -0.484589 -0.655185 -0.204914 0.159737 -0.282760 0.234622 0.500775 -0.183499
530 -0.961221 -0.504134 -0.748347 -0.861121 0.751870 0.482141 0.763290 -1.201006 0.114722 -0.032613
531 -5.636827 4.306331 2.305551 -1.639501 1.012625 -1.172566 0.742545 0.146591 0.115015 0.273037
532 -3.651377 -1.884882 1.348532 -0.295016 -1.253302 -0.785488 -0.436708 0.024311 -0.018301 0.312133
533 3.969095 0.924240 -1.600987 -0.205998 0.762276 0.222358 -0.127734 0.465944 -0.381515 0.105762
534 3.955656 2.926503 -0.848281 -1.665068 0.623537 -0.433541 -0.444767 0.699684 0.420238 -0.256639
535 -0.069146 -2.062154 -1.631536 -0.586851 0.283639 0.859066 -0.724844 0.314403 0.032393 0.128660
536 -5.191898 0.092801 0.740395 0.341453 -1.349609 0.853240 0.157640 0.374801 0.171627 0.473800
537 3.505105 -2.994699 -0.809246 -0.597490 -0.228574 -0.617582 1.309767 -0.024032 0.336022 0.012351
538 -3.075324 -0.570614 0.304415 0.790829 -0.376888 0.138510 -0.991490 -0.033818 -0.218553 0.341594
539 -5.197683 3.828849 0.162409 0.386636 1.839621 -1.368792 0.179672 0.484567 0.192187 -0.043723
540 0.378164 -1.679305 -1.067800 1.869200 0.820149 0.884516 0.318597 0.183929 0.163986 -0.273442
541 4.141594 -2.880453 0.178589 -0.139572 0.097303 -1.214878 0.290148 0.140768 0.268725 0.490660
542 0.549980 -2.607372 0.768488 -0.813062 0.009697 -0.625436 -0.741870 -0.599793 0.236355 0.118904
543 1.100531 -1.504744 1.095928 0.895174 0.256898 0.400618 -1.142399 0.491275 -0.273962 0.177044
544 1.274328 0.253541 0.250316 2.484690 -0.360793 1.418439 -0.400458 0.464017 -0.077343 -0.044292
545 0.767701 1.001937 -0.627391 -1.458819 -1.938940 0.498564 -0.524264 -0.144640 0.598033 -0.074428
546 3.359165 2.867446 0.075806 -2.331984 0.760074 0.038064 -0.246890 0.837464 0.346311 -0.236523
547 1.816273 -1.484963 -0.989831 -0.022518 -0.320745 -0.202364 0.879692 -0.138203 0.344988 -0.304494
548 1.221128 -1.788262 -0.139917 1.789845 0.173162 0.395568 -1.087402 0.370081 0.087704 -0.163807
549 -3.958296 0.766976 -0.194597 -0.180359 -1.273051 -1.636344 -0.501781 0.133863 -0.056648 -0.503250
550 5.118476 1.629683 -0.991878 0.094104 0.978434 -0.449386 0.104992 0.272380 -0.484737 0.018667
551 3.150752 1.511003 0.834753 -1.535273 -0.635914 0.799875 -0.420832 -0.760519 0.364194 0.025373
552 0.196675 -0.582129 0.329880 -0.426536 1.154610 0.354674 -1.230156 -1.044608 0.064668 -0.065490
553 2.327286 3.403261 0.244199 0.748012 -1.165761 0.080131 0.088989 0.467963 0.295808 -0.555813
554 -3.512471 -1.884757 0.046145 -2.180224 1.920916 0.539986 -0.332144 0.562859 -0.731698 0.119883
555 -1.251444 -0.668046 -1.409311 0.236192 0.147629 0.507886 0.496747 -1.264092 0.080404 -0.039435
556 -5.959270 2.027892 0.278284 2.380150 2.590534 0.863469 -0.365097 0.653201 -0.172103 0.375087
557 3.498774 0.717158 0.449387 0.229427 0.995974 -0.106675 0.531240 -0.090390 -0.381143 0.249033
558 2.699546 3.643171 0.315260 0.598653 -0.954804 -0.481433 0.061053 0.354594 0.539442 -0.335906
559 -4.850951 0.193091 -0.265423 2.132564 -0.695137 0.479784 -0.158575 0.115405 -0.150455 0.380072
560 -4.278507 1.687660 -0.379408 -0.015870 -0.530258 -1.556049 0.288956 0.244097 0.184653 0.453913
561 0.499447 -0.311767 1.766877 1.058348 0.376578 1.364378 -1.056927 -0.452380 -0.119124 -0.237960
562 -4.364900 -0.003767 0.806598 -0.938844 -0.232709 0.219743 -0.188212 1.375771 -0.150111 0.160965
563 2.019538 -0.349147 -0.034809 -2.160634 1.550033 0.527082 0.988258 -0.326949 0.033606 -0.122181
564 1.787993 -3.029671 1.865452 0.949720 1.768691 -0.432573 -0.255381 0.950406 0.705944 -0.366983
565 -1.712000 -2.633059 0.241597 -1.088077 -0.985680 -0.127653 0.712810 0.268568 -0.186003 -0.304034
566 -4.646302 0.276787 -1.700496 0.563817 -0.202430 -0.281603 -0.571222 0.118318 -0.534773 -0.639437
567 1.159480 0.300373 0.225377 0.315393 0.008153 -0.353862 -1.157817 -0.540819 -0.286283 -0.184484
568 2.634784 3.551601 0.228037 0.333509 -0.130014 -0.407785 0.158830 0.246193 0.428787 -0.447130
569 3.437770 -2.332439 -0.758089 0.316485 -0.085105 -0.641015 -1.195336 0.944632 -0.224755 0.182314
570 -5.135023 -0.561168 0.471306 -2.341356 0.556001 1.762510 -0.087206 0.232487 0.365639 0.174149
571 1.120943 -0.833528 -1.116582 -0.683706 0.904907 -0.193443 0.638216 -0.127193 -0.396080 -0.175489
572 0.224804 -1.569001 -1.326364 0.037839 -0.545916 0.762538 -0.222696 0.306284 -0.220732 -0.261987
573 0.647865 1.759656 -0.295109 -0.543929 -2.517701 -0.274213 0.051864 0.193889 0.544163 0.028449
574 -4.474658 -0.112173 -0.419255 0.043648 -0.140020 1.229305 -0.000653 0.318513 -0.308127 -0.074815
575 -4.925439 -0.424996 1.146603 0.289343 -0.924124 0.391573 0.098635 0.803745 -0.499783 -0.100031
576 -4.972993 0.264258 -0.890597 0.346616 -0.649329 -0.699843 -0.700721 0.417535 -0.056450 0.189258
577 -3.658868 0.455897 -0.350443 0.916063 -0.832942 -0.634725 0.871250 -0.397585 -0.456784 -0.408356
578 0.025757 -2.569312 -0.668587 -0.743746 -0.068119 -0.997391 0.911199 -0.625102 0.296661 0.287613
579 4.131601 0.103588 -0.094754 0.666136 -0.188088 0.135684 -0.182403 -0.111392 -0.685549 0.534894
580 2.784441 3.336810 -0.231402 -0.037132 -0.305151 -0.452664 -0.319422 0.061125 0.610653 -0.109837
581 3.223628 -0.396323 -0.638913 0.033360 -0.079505 -0.607884 -1.252066 -0.035392 0.412770 -0.123423
582 -4.632998 0.550178 -0.775348 -2.265772 0.513273 -0.124237 -0.210749 0.168376 0.255886 -0.022838
583 -4.426195 0.845545 -1.992055 -0.323030 0.178728 0.421330 -0.531425 0.108332 0.276275 0.062321
584 -2.713276 0.474146 -0.230420 1.361522 1.212973 -0.732298 0.487182 0.102438 0.168022 0.191884
585 4.816429 -2.284407 1.410414 -0.690821 -0.371436 -0.486921 0.950946 0.148697 -0.228274 0.024112
586 -4.709312 1.262423 0.917355 -2.378035 -0.679850 0.131904 0.979944 -0.426499 0.678254 0.293531
587 3.396031 0.288763 0.616615 -1.278122 0.111357 0.832428 -0.805508 -0.537156 -0.243864 0.218997
588 2.578269 -0.450304 0.891084 0.751508 -0.517107 -0.572818 -0.684262 -0.308076 -0.546192 -0.034527
589 -5.442493 0.548813 -1.259878 0.348880 0.955170 1.183397 -0.366726 0.206783 0.356327 0.415470
590 2.411794 3.008438 0.457760 0.158048 -1.175431 0.113725 0.223759 0.124918 0.167050 -0.046215
591 4.426990 0.250836 1.488931 -0.644146 -0.649406 0.314259 -0.118964 -0.634944 -0.581514 0.241229
592 2.077525 1.725476 0.418847 1.212716 -1.170184 0.465056 0.070103 -0.609360 0.379855 -0.061661
593 1.643083 -1.141956 -1.846305 -1.444973 0.072578 -0.717828 0.562486 -0.797818 -0.141358 0.055852
594 4.203504 3.119067 -1.084995 -0.962297 0.311749 0.537013 -0.518215 0.060649 0.197537 0.034986
595 -1.083431 0.442788 0.009014 2.010741 -0.034929 -0.368301 1.075898 -0.690032 -0.344953 0.132698
596 0.328249 -0.021174 1.476608 0.623044 -0.112375 -0.394709 -0.963170 -0.732491 -0.090446 -0.049558
597 3.488003 -0.899064 -1.434199 -0.337118 -0.105004 -0.728245 1.076001 0.002433 -0.485074 0.256406
598 -0.244618 0.307308 1.119921 0.757120 0.720867 -2.607233 0.081919 -0.185509 0.793303 -0.148605
599 3.062489 -2.320005 -1.185454 -0.669441 0.246884 -0.892602 0.621020 0.207454 -0.392955 -0.135711
600 -0.616047 -2.212253 -1.457425 0.821745 1.632492 0.583363 0.434173 0.494583 0.382345 -0.097787
601 2.099146 -3.400158 -0.426321 0.555458 -0.419252 -0.497519 -0.033409 0.443194 0.415367 0.042678
602 -5.023115 -0.269625 0.040822 0.170760 0.617614 1.469143 -0.823194 -0.344655 0.328796 0.024565
603 1.184529 -2.455368 1.804318 -0.676607 1.787521 0.684779 -0.145031 -0.682174 -0.049228 -0.139768
604 0.307683 -1.150842 2.617561 0.145725 0.062763 0.161198 0.182714 -0.714971 -0.210290 0.503164
605 -4.892748 -0.388182 0.824172 0.826365 -1.058789 1.422191 -0.473046 -0.288901 0.189173 0.487032
606 3.063887 -2.543548 1.520348 -0.134372 -0.729879 -0.120763 0.822514 -0.115483 0.309021 0.531793
607 4.242915 -2.338328 -0.884001 -0.390901 0.015841 -0.655153 1.245117 0.101875 -0.055939 0.115027
608 3.565789 -1.053082 1.498624 -1.551654 -1.542583 -0.155194 0.080979 -0.282265 -0.364057 0.383940
609 3.048847 3.579198 0.947546 -0.307829 -0.235091 -0.458213 0.312187 0.407421 0.145335 -0.168013
610 -4.268370 0.788462 -0.512411 -1.663303 0.312554 0.590895 0.638682 0.070795 0.039321 0.223612
611 0.121689 1.543642 -0.226532 -0.377573 -2.519276 0.310742 0.419186 0.254399 0.094494 0.060162
612 6.773801 2.703159 0.563860 0.830958 0.990474 -0.074619 -0.324028 0.695160 0.263589 0.243475
613 1.269963 -2.281856 1.357065 1.877682 0.801641 0.008786 -0.590872 0.112771 0.251371 0.029640
614 6.257189 2.125144 2.621406 -0.802963 0.530376 0.350766 0.321993 1.005971 -0.424157 -0.150855
615 3.377203 -3.769726 1.308174 -1.590775 1.603062 -0.597708 0.944052 -0.380628 0.414630 -0.043652
616 2.040990 -2.563774 -0.214168 -1.500365 0.315926 -0.044368 0.926479 0.124123 0.077736 -0.134243
617 5.323007 2.575278 0.376950 -0.518170 0.867240 0.576932 0.100148 0.599030 0.169932 -0.144541
618 3.043011 0.538022 -0.029464 -0.583360 -0.670996 -0.521397 -0.576925 1.210586 -0.828967 0.276107
619 -3.532365 2.211118 -0.068652 0.148951 -1.712010 -1.454181 0.372003 -0.330323 0.365545 0.334132
620 -5.456465 0.206519 -1.197652 1.656961 0.180166 0.590499 -0.689120 0.624585 -0.141556 0.489998
621 0.765826 1.073401 -1.124133 0.739790 -1.676035 -0.269422 0.528877 0.065675 -0.020298 -0.515626
622 -0.636154 -1.423757 2.436356 -1.437151 0.584696 0.066614 -0.141520 -0.527530 -0.144924 -0.580693
623 -5.117689 -0.702771 1.835015 -1.437842 -0.396115 1.328622 0.195677 0.716855 0.505833 -0.181985
624 3.383607 -0.466610 2.584310 -1.500951 0.505691 0.451854 0.597950 -0.454104 -0.169488 -0.246660
625 -4.017133 0.389044 -0.303110 -1.138160 0.680661 0.841420 -0.066073 0.355857 0.352388 0.180842
626 2.187577 -0.310337 -0.787962 1.667223 0.677801 0.767814 0.676090 -0.549302 -0.446308 0.544668
627 1.728971 -0.278520 -0.654656 1.853164 -0.122410 0.657977 0.066749 0.076075 -0.367595 0.120799
628 -2.079542 -1.014280 -0.847048 1.451819 1.141396 0.725562 0.796287 0.481908 0.347511 0.112018
629 2.655654 -1.869420 -2.364908 -0.889643 0.764273 -0.379224 0.709453 -0.097984 0.106719 0.130151
630 3.594110 0.539076 -1.149326 -0.049117 0.626670 -0.736758 0.378471 -0.471010 -0.604885 0.254435
631 -3.385298 -0.440425 0.618830 -1.050505 -1.801453 -1.523264 -0.641517 -0.280449 0.038591 0.047956
632 2.123482 2.532386 -1.349755 1.038683 0.780649 0.755208 -0.159208 -0.000832 0.098821 -0.099687
633 -3.471775 -1.486374 1.117136 0.394643 -0.942791 -0.327207 0.191011 0.040537 -0.326768 0.214242
634 4.576804 2.631888 -0.557832 0.028253 0.703354 0.709738 -0.741268 -0.057268 0.190690 0.182454
635 3.153548 1.564858 -0.438771 -0.182500 -0.232971 -0.436978 -0.169768 1.346656 -0.614027 -0.142253
636 1.854613 -2.904985 -1.445167 -1.176118 0.522256 -1.323292 1.068697 0.040486 -0.121753 -0.299198
637 2.379520 3.201664 0.370998 0.121913 -0.125725 0.253958 0.511643 0.286259 0.068181 0.160332
638 -1.327258 -1.274475 0.013178 2.669036 0.054739 -0.055791 0.747146 0.813148 0.467959 0.103617
639 -5.230427 -0.327849 -1.921508 0.193374 0.504105 0.487603 -0.884773 0.155707 -0.232675 0.405389
640 -2.808987 0.244840 -0.937761 1.200497 -0.922660 -0.636555 0.845995 -1.253049 -0.205299 -0.578130
641 1.155747 0.364265 0.114011 2.242174 0.431652 2.004915 -0.202271 -0.090911 0.103432 -0.019046
642 -2.114038 -1.248158 2.233066 0.387148 -0.438563 0.652689 -0.111507 -0.372253 -0.249800 0.000332
643 -0.339674 -1.551433 -0.251257 1.725839 1.216702 -0.508791 -0.422711 -0.246672 0.103925 0.233636
644 0.303053 -0.928144 -1.749208 -0.874707 0.546004 0.944862 0.056781 0.174327 -0.100143 -0.495338
645 1.759326 0.483199 -1.240058 0.376221 0.216603 -0.248491 -0.319973 -0.723746 -0.002882 0.246122
646 1.223070 -2.824009 1.126703 1.423203 0.709855 -0.279531 -0.217347 -0.262867 0.422320 0.146586
647 2.874180 1.156501 1.392052 -1.409183 0.363101 0.432400 -0.246153 -0.486785 -0.138961 -0.017905
648 -4.162843 0.851260 0.721651 -0.378870 -1.606980 -0.859524 0.141500 0.177956 -0.301052 -0.205176
649 2.109913 -0.416467 1.052036 -0.166364 0.583877 0.591819 -0.337327 -0.260164 -0.405634 -0.235647
650 -4.014147 0.390406 0.372133 0.686138 -0.121388 0.891726 0.617373 -0.213423 -0.296896 0.061660
651 3.011779 1.632563 1.459678 -0.006963 -0.030810 0.481328 0.480824 0.081088 -0.379080 0.041744
652 0.913266 -4.053311 2.071245 -0.610485 0.237527 -0.629830 -0.006914 0.350368 0.440862 -0.006510
653 -0.688854 -2.598056 -0.130584 0.435887 -0.535650 -1.114315 -1.450250 -0.453747 0.227228 0.167126
654 -1.449793 -3.289790 -1.210242 -1.919063 0.457189 0.013506 0.470732 -0.148401 0.076068 0.249737
655 5.583175 1.439491 -0.743360 -0.409713 -0.651032 -0.435900 -1.147089 0.179746 -0.946100 0.333047
656 1.773303 0.272042 1.442716 0.858074 -0.455994 0.680371 0.439505 -0.117846 0.240770 0.003082
657 0.356631 0.933456 -0.854873 -1.493082 -0.742427 1.426558 -0.355675 -0.134340 0.330940 0.012921
658 2.302019 -3.360681 -0.081209 -1.203784 -0.035357 -0.465708 0.409334 -0.007600 0.413030 0.180142
659 -2.697937 -1.055344 -1.066329 0.937338 0.121688 0.171426 0.252516 -0.610816 -0.260538 -0.206600
660 3.973654 -3.448128 0.132331 0.191090 -0.624255 -1.663787 0.198185 0.149832 0.510371 0.336544
661 -2.407544 -1.731788 -0.775048 -0.698843 0.736595 -1.043783 -1.168621 0.337443 -0.325971 0.108601
662 2.625498 2.181371 -2.142287 -0.701689 1.902569 0.641839 -0.648321 -0.478342 -0.098922 -0.008224
663 0.070930 0.540171 -0.472131 0.202107 -0.122772 0.272146 0.315791 -0.561466 -0.161921 -0.081693
664 1.864889 -2.890375 -0.991965 0.520081 -0.744796 -0.526124 1.138161 0.178504 0.283196 -0.306992
665 -0.051939 0.547819 -1.846956 0.339602 -0.926442 0.632640 -0.332272 -0.189884 0.212084 0.111888
666 -1.471740 -2.289561 0.100406 -0.474892 0.164714 -0.453950 -1.404085 -0.010534 0.142366 0.180902
667 -4.671324 -0.980931 0.165627 0.250154 -0.222246 -0.004969 -0.055576 0.552823 -0.684671 0.029989
668 -0.728308 -1.353938 -1.312066 -1.015690 -0.235752 2.688891 -0.143616 0.220440 -0.033221 -0.462399
669 2.497967 3.174942 -1.040168 0.549363 0.357326 0.049027 0.065532 -0.032197 0.338145 -0.190913
670 -2.696106 -0.072595 -2.272370 0.211127 0.379523 -0.043983 0.336038 -1.000778 -0.259912 -0.309132
671 -0.757671 -2.816576 1.486603 -1.095124 0.633324 0.234940 -0.328662 0.681877 0.038346 0.079490
672 -1.806419 0.830279 -0.762798 0.739829 1.047768 -1.301631 -0.371791 -0.525816 0.271471 -0.135947
673 2.699542 -2.280415 0.119603 0.680610 -0.358075 -1.899428 -0.593440 -0.175137 0.204967 0.279655
674 1.532425 -1.233355 0.164945 0.846327 0.406933 0.346273 -1.321483 -0.217214 -0.328292 -0.202440
675 -5.653481 0.251736 0.442926 1.546558 -1.392817 0.616219 0.109796 0.134708 0.218430 0.805377
676 1.700231 1.353766 0.901123 1.489475 -0.155750 1.519111 0.266913 -0.053237 0.292703 -0.135146
677 -2.498726 -0.270308 0.619222 1.392114 1.633676 0.486217 0.673726 1.295987 0.104924 0.296879
678 2.281513 3.185373 -0.926620 -0.157413 0.168340 0.231712 0.016394 -0.026413 0.311596 -0.388476
679 1.158962 -0.919278 -0.047675 1.523822 1.087054 1.352242 -0.587596 0.077572 0.331777 -0.079687
680 0.125415 0.474058 -1.370895 0.330314 -1.004472 0.989103 -0.889152 0.621814 0.085253 0.129162
681 -0.196677 -2.139129 -1.727945 0.407135 2.447671 0.674664 0.537321 0.322504 0.586509 0.295006
682 0.694470 1.455145 -0.087109 -0.009897 -2.380322 0.139985 0.101637 0.412382 0.266597 -0.114713
683 -6.149459 3.948102 -0.042278 0.154395 2.563193 -1.330562 0.379800 -0.154216 -0.462629 -0.118437
684 0.774642 -2.302665 1.827246 0.773850 1.236406 -0.511639 -0.105137 0.823387 0.485297 -0.378251
685 2.873079 3.238763 -0.600620 -0.719084 0.363375 0.066456 -0.420240 0.010234 0.626544 -0.027194
686 3.298214 -1.542780 -0.472816 0.622813 -1.001711 -1.243607 0.212138 -0.174105 -0.474453 0.236266
687 -7.149829 3.658068 1.925601 0.725468 2.735383 1.132127 0.436487 0.168024 -0.138697 0.162905
688 5.411053 1.925686 0.719509 0.127806 0.962780 -0.040925 -0.344936 1.052961 -0.324307 0.122736
689 -3.240004 -1.706659 -2.596057 -1.576886 0.442909 -0.265910 -0.468758 -0.298973 -0.027892 -0.110773
690 0.221767 -3.416326 0.405756 0.248635 -0.646107 -1.210695 -0.470021 -0.399868 0.426782 0.157032
691 1.400343 0.116010 -1.139857 1.322816 0.910722 1.323929 0.557241 -0.313522 -0.515246 0.251174
692 -3.576698 -1.610253 -0.169665 -0.447562 -0.134044 -0.299333 0.149040 0.403991 -0.482373 -0.192048
693 0.765025 1.620213 0.552595 -0.730120 -2.371879 0.193121 0.213068 0.529915 0.429678 0.072494
694 -1.199233 -2.283571 -0.079035 -0.160601 -0.288705 -0.709718 -1.020125 -0.214133 0.002095 -0.053744
695 3.075394 2.317952 0.417181 -1.308071 0.077894 0.160922 0.185999 0.836670 -0.252286 -0.239856
696 2.118619 -0.089617 0.302792 0.752476 -0.720308 -1.064828 -1.390633 -0.638509 -0.246584 -0.080356
697 1.700205 -2.247877 0.633887 2.323776 0.489570 -0.732546 -0.705011 0.277196 0.643179 -0.167561
698 2.236612 0.842103 -0.197972 1.526192 -0.586666 0.065892 -0.286404 -0.436885 0.026987 0.348809
699 -0.060412 0.895166 -1.429690 -0.015208 0.886068 -0.103066 0.114297 -0.537557 -0.337687 -0.321030
700 -4.210172 0.247527 0.257750 -1.810260 0.136718 0.258042 -0.222683 0.322141 0.140298 0.400402
701 -3.744810 0.022307 0.330716 -0.242812 0.051632 -0.220729 -0.422277 0.345824 -0.409140 -0.757743
702 -0.843379 -0.864120 -2.361774 -0.556572 0.880955 -0.715629 0.264451 -0.556373 0.042884 -0.082433
703 1.467213 -3.443090 -2.089858 -1.209361 1.024765 0.485781 0.822347 0.084710 0.398576 -0.182467
704 -3.438588 1.441696 -0.451807 -0.041016 -1.151867 -1.492948 -0.145683 -0.520243 0.161769 -0.052481
705 -4.828065 0.313749 -1.461586 -1.319783 0.855012 0.981965 -0.327833 0.642652 -0.017055 -0.084405
706 0.825284 -0.804295 0.059881 1.336906 -0.123954 0.403308 0.112576 -1.158574 -0.570738 -0.474946
707 4.321063 -2.498388 0.283864 -0.860815 0.312707 -0.665634 0.512363 0.715053 -0.228453 0.421315
708 0.250616 1.593472 -1.463682 -1.121100 -0.923570 0.257457 0.047260 0.302725 0.105977 -0.060178
709 -0.859821 -1.848697 2.261289 0.005666 -0.227972 0.524449 -0.358252 -0.140329 -0.104010 -0.062771
710 -4.396621 2.277956 0.215804 0.469696 1.850813 -0.501008 0.527276 -0.136460 0.094180 0.127241
711 -3.860903 0.592910 -0.296957 0.795349 -0.683804 0.308431 0.416720 -0.195611 -0.532229 -0.599431
712 -2.683537 -0.939693 -0.572006 -0.222563 0.078579 -0.969127 -1.181664 -0.178035 -0.210227 -0.272473
713 -4.989289 -0.667002 0.074164 -1.043845 0.070001 0.402827 -0.274885 0.237989 0.070750 0.294848
714 0.516737 -2.593084 -1.450698 1.648032 0.247685 0.228404 0.313583 0.386291 0.338543 -0.300148
715 -5.033499 -0.095082 1.257088 0.013188 0.418025 1.330182 -0.059932 -0.197629 0.186276 0.114776
716 -0.258378 -2.228627 0.339825 0.266710 -0.796423 -1.713158 -0.752129 -0.387901 0.027641 0.053035
717 -0.287785 -1.536905 -0.685724 2.242644 1.503322 0.471862 0.856433 0.476916 -0.120605 -0.006636
718 -4.470840 1.063876 0.837272 -2.385926 0.268779 -0.255185 0.435385 -0.176982 0.325602 -0.326780
719 -4.379769 0.342756 -1.098038 -0.440407 0.086972 0.732018 -0.326064 0.132807 0.060892 0.011927
720 0.947750 -0.820518 2.515370 -0.086642 -0.143990 0.194064 -0.283031 -0.060137 0.073791 -0.148244
721 -5.354435 -0.853561 0.496735 0.471321 -0.860463 1.247973 0.018174 0.232610 -0.552732 -0.224159
722 0.083179 -0.178647 -1.988894 -0.680356 0.478536 1.996251 -0.542156 0.352574 0.144911 0.054747
723 -2.180761 -1.590307 0.102232 -0.095978 -0.083858 -1.177690 -0.781129 0.080945 -0.216100 0.156452
724 0.251377 -0.733325 -0.349295 0.490380 -1.794387 -0.198997 -0.133987 0.321507 -0.051841 0.239219
725 3.340308 -0.562328 0.844673 -0.402455 -1.094969 -0.986381 -0.436864 0.297738 -0.384242 0.041440
726 -3.214048 -1.826778 1.819533 0.019058 -0.773350 -0.058149 -0.131379 -0.097251 -0.483144 0.066104
727 0.471943 -2.817782 -0.651525 1.547304 0.530533 -0.256131 0.654812 0.651463 0.434616 -0.156751
728 4.247837 -0.265390 2.023741 -1.363959 -0.385617 0.647179 0.028887 -0.009693 -0.630232 0.214719
729 -3.556804 -0.514423 0.867529 1.542973 -0.145442 0.654259 -0.893708 0.267448 -0.490565 -0.145605
730 -5.120990 0.402076 1.303819 -1.594962 -0.276485 1.244757 0.675629 0.223478 0.629313 0.455918
731 -4.520511 3.727584 1.903709 -0.620280 0.829798 -1.234743 0.604315 -0.250370 -0.052073 -0.560402
732 1.522963 -0.712301 -0.981981 2.013572 -0.995361 0.392857 0.395605 -0.157773 0.123888 -0.140731
733 -6.410322 4.467780 2.016085 -0.230775 1.374614 -2.024615 0.740661 0.666310 -0.195082 -0.292166
734 4.270085 3.461819 0.399415 0.196227 -1.088706 -0.274286 -0.228665 1.125791 0.039974 -0.235343
735 2.448564 0.390085 -0.233878 -1.547214 1.261644 -0.076729 -0.957921 -1.184174 -0.073425 0.018522
736 -3.756669 -0.504934 0.804960 0.557479 -0.513456 0.543298 -0.230653 0.038171 -0.548689 0.233243
737 -3.317851 2.592119 1.097721 -1.690992 1.361734 -0.992424 0.657394 0.473451 0.546066 -0.113326
738 -3.431508 1.499662 -0.039464 1.056898 1.693244 -0.730427 -0.170182 -0.376847 0.114241 0.073308
739 0.421559 -1.672120 -0.319766 0.391845 -1.277019 0.272035 -0.182739 0.538049 -0.054338 -0.088588
740 -4.492175 -0.232952 -1.248353 -0.984647 -0.363538 -0.439293 -0.922126 0.029940 -0.378635 -0.050874
741 2.152257 -1.705175 1.284796 0.678950 0.556799 0.367117 0.412008 -0.001686 0.334085 0.012783
742 2.584117 -0.648107 -0.249335 0.360937 -1.104070 -1.721938 0.260786 -0.290346 -0.477434 -0.210340
743 -2.514086 -0.482780 0.234757 1.173215 -0.490273 -0.652487 -0.882423 -0.480321 -0.195898 0.337534
744 -0.154230 -1.721613 -1.432020 -0.591498 0.341939 1.531459 0.027546 0.301988 0.053409 -0.583904
745 2.068714 2.652100 0.093471 1.533246 -0.526543 0.199640 -0.145197 0.174408 0.390268 -0.361555
746 2.464659 -0.584666 -1.048440 -0.323252 -0.892403 -0.393741 0.132313 0.255737 -0.221494 -0.223109
747 2.635209 2.985660 0.098555 -0.719994 -0.221554 0.406133 0.428924 -0.559295 0.294983 0.110111
748 0.500089 -1.779567 -0.529437 1.258638 -1.427705 -0.366974 0.481715 0.181122 -0.050519 -0.495384
749 -2.259163 0.040411 -1.212858 1.912664 0.083921 0.265542 0.395933 -0.705624 -0.501946 -0.277753
750 0.167265 -0.988683 2.128413 -0.782354 0.476199 -0.362764 0.304393 0.007223 -0.180705 0.011764
751 5.629573 1.966947 -0.985615 -0.563671 1.355806 0.253149 -0.791591 0.411853 -0.081121 0.287074
752 0.872482 -2.936951 1.204501 1.321600 1.992788 0.338009 -0.847463 1.059746 0.628848 -0.314080
753 2.147648 -2.743115 1.484140 -0.530121 -0.351008 -0.445031 -0.108609 -0.017170 0.130545 0.294343
754 2.652530 -1.492550 -0.491470 -0.239680 -0.393271 -0.011320 0.562318 0.524051 -0.071063 -0.067737
755 4.696231 -0.187260 -0.795672 -0.352539 0.226277 -0.806860 0.788655 0.068421 -0.590586 0.321126
756 -3.031930 0.482054 -0.884546 1.412167 -0.998388 -0.105807 0.291919 -0.636768 -0.355165 -0.578598
757 1.893297 0.569207 -0.032550 -1.740718 0.989549 0.711372 0.361509 -0.046300 -0.387576 0.131352
758 2.167754 2.760044 0.327633 0.627470 -0.593316 0.870893 0.520282 -0.143481 0.157605 0.263212
759 0.154130 1.879747 -1.142993 -0.462307 -1.781954 0.158663 0.392033 0.667010 0.066239 0.117758
760 -2.084005 -2.158939 -0.066809 -1.391443 0.728467 0.035000 -0.789539 0.430130 -0.238980 0.165000
761 -3.722486 -2.340493 -1.398732 -0.522575 -1.147814 -1.690822 -0.687567 0.907670 -0.290495 -0.125537
762 2.408041 0.519798 -0.723017 1.317171 -0.516465 0.022130 0.100368 0.556997 -0.243044 -0.014976
763 -4.250563 -0.115855 1.015167 1.642981 -0.639676 0.608750 -0.358676 0.338787 -0.269420 0.401302
764 -4.033444 1.043215 -0.512248 -2.585245 0.733742 0.428792 0.441340 -0.209028 0.129604 -0.139886
765 2.323219 2.725051 0.618629 -0.080058 -1.114381 -0.129498 0.227357 -0.084246 0.265709 -0.263311
766 0.272852 -1.782937 0.717266 -0.259860 1.105502 0.412647 -0.988499 0.135435 -0.231055 0.127755
767 2.057850 -1.647550 0.324383 0.705508 0.320371 0.261062 -0.102573 -0.070454 0.302444 0.107110
768 -2.161249 0.500817 0.217955 0.991618 0.002955 0.191974 -0.843209 -1.145705 0.002124 -0.316391
769 2.202458 -2.306056 2.376549 -0.645824 -0.515414 0.277261 0.068754 -0.085445 -0.735018 -0.169886
770 2.341606 2.822123 0.429820 -0.635372 -0.878305 0.369732 0.694827 -0.564334 0.250210 -0.245962
771 -2.918299 -1.660093 0.209845 0.586800 -1.191922 -0.615045 -1.010977 -0.675382 0.110807 0.484298
772 -2.666205 0.561335 -0.527264 1.815576 -0.778443 0.242168 0.681625 -0.658672 -0.329408 -0.505178
773 2.260824 1.405471 -0.063833 0.175103 0.091436 0.046520 -0.195434 0.022219 0.294612 0.034107
774 2.915433 -1.112246 0.063048 0.075255 -0.996016 -0.616663 -0.869399 0.637632 -0.222197 -0.136343
775 0.705056 -1.506351 0.824336 1.937272 1.168158 -0.943326 -1.029800 0.437037 0.716434 -0.361291
776 -2.129679 -0.295190 1.245713 0.687428 0.090735 0.459170 -0.500631 -0.429980 -0.082541 -0.777037
777 -4.030800 3.999053 1.660086 -0.769396 1.715817 -2.761494 0.909626 -0.004052 0.197784 0.225275
778 -3.992262 -0.543019 -0.510705 -0.805673 -0.060130 -0.798748 -1.186383 0.345829 -0.269305 -0.016068
779 3.520300 2.100782 0.575184 -2.187643 -0.238977 -0.348414 -0.294022 1.263852 -0.225937 -0.166753
780 -2.956747 -0.551626 0.523931 0.423967 0.207786 -0.555093 -0.730652 0.619867 -0.580902 -0.327911
781 2.585119 -3.118304 -1.203344 0.570614 -0.984057 -1.055263 1.199343 0.127469 0.445176 -0.198504
782 -1.636064 -0.475758 1.579483 1.178990 -0.361936 1.438611 -0.897811 -1.076743 -0.026605 -0.187455
783 -4.625264 0.304240 0.744578 -0.318641 -1.334747 0.188101 0.109546 0.741597 -0.204168 0.035828
784 5.143985 0.537961 0.105054 -1.719350 0.835916 0.565437 0.455840 0.537737 -0.539675 0.029448
785 2.768921 3.287569 0.094897 0.008717 0.207227 0.287158 0.189193 0.228790 0.338850 -0.026792
786 -5.107395 0.168162 -1.236578 0.351437 -0.107896 0.485841 -0.595630 0.327995 -0.192168 0.482221
787 3.631337 -0.163954 0.564735 -1.182163 -1.200630 -0.975325 -0.570783 0.741399 -0.211941 0.021042
788 -4.623603 0.419567 -1.680727 -0.573476 0.872330 -0.504536 -0.966432 0.772308 -0.382191 -0.082324
789 1.252837 0.213648 0.564138 -0.224028 0.614985 -0.195971 -0.812842 -0.790075 -0.354978 -0.161096
790 2.947305 3.794260 -0.720333 0.190133 0.641354 -0.360721 0.053996 0.060247 0.476582 -0.079244
791 2.127306 -1.055405 -1.554129 0.701295 -0.934567 0.083221 0.248072 -0.186548 0.228295 -0.279734
792 -3.015566 0.664356 0.796366 -1.765379 -0.824966 -0.887554 0.330554 -0.385827 0.005882 0.201481
793 -1.539290 -0.483558 2.049660 0.464921 1.036244 -0.326827 0.606610 0.224943 0.245990 -0.030608
794 1.798737 -0.479788 0.009595 0.704564 0.405364 0.947087 -0.190390 -0.128872 0.023220 0.190472
795 4.491288 3.464735 -0.513632 -0.424731 0.097691 0.283862 -0.084408 0.444254 0.238646 0.180729
796 4.284423 -1.707151 -0.630451 -0.750979 -0.454069 -0.892568 0.630096 -0.318063 -0.281556 0.061922
797 -4.534827 -1.483987 -1.326514 -0.049394 -0.837976 -1.358560 -0.107332 0.265874 -0.433259 -0.345265
798 -4.357063 1.433284 -1.552903 -1.338102 0.218451 0.407110 -0.153389 0.046070 0.359233 0.223137
799 1.537984 -1.811257 0.480721 1.357271 1.253398 0.575322 -0.332273 0.309081 0.328487 -0.249560
800 1.710901 -0.374852 0.408464 -0.033996 -0.562079 0.440878 0.207304 -0.091533 0.020946 -0.118794
801 4.293864 1.112134 -0.521178 0.009754 0.696720 -0.529049 -0.221747 -0.253512 -0.081914 0.377286
802 0.224249 -1.409600 -0.939810 0.360472 1.631425 0.489428 0.432872 -0.892922 -0.218901 0.192847
803 -1.351496 -1.646134 0.115257 1.161807 1.027158 0.920276 1.077561 -0.012260 0.331540 -0.265999
804 -3.454789 -1.436720 -0.461612 0.552259 -1.059179 -1.225066 0.193309 -0.035668 -0.335135 -0.047931
805 2.285443 2.027703 -0.092062 1.861575 -0.637724 0.332474 -0.156526 -0.284660 0.284490 0.058250
806 1.170845 0.377050 -0.726714 0.320364 -1.079743 -1.089338 0.069564 -0.711116 -0.275493 0.135839
807 -3.754625 1.092798 -0.604770 -1.019536 -0.610423 -0.708949 -0.341894 -0.238539 0.084204 -0.471002
808 2.013289 1.329993 -0.739209 0.751711 -0.174138 -0.337968 0.787139 -0.611829 0.027438 0.227832
809 4.420343 2.645150 0.114057 0.652475 0.276519 -0.636215 -0.470222 -0.482428 0.344017 0.402503
810 -4.300252 1.175458 0.718433 -0.321793 -0.800886 1.092213 0.430553 -0.086025 0.253346 0.149496
811 3.650663 0.552271 -1.505859 -1.237288 1.518906 -0.266215 0.149762 -1.172929 -0.463907 0.282559
812 0.897759 -2.292463 0.550344 2.333228 1.211201 -1.378227 -0.566336 0.529166 0.488683 -0.099978
813 0.760649 2.057159 -0.727863 0.075645 -2.234913 -0.316781 0.329137 0.419679 0.333801 -0.007374
814 2.485764 2.977885 0.565265 -0.244083 -0.310820 0.264479 0.313735 0.168054 0.305659 -0.116996
815 1.560492 1.330611 0.174191 1.840993 -0.969572 1.373540 0.220099 -0.531223 -0.665355 0.383597
816 -0.251941 0.525286 -0.148450 0.019603 -1.911060 1.288805 0.470987 0.413186 0.238545 0.041356
817 -5.032324 -0.436052 0.196049 -1.757402 0.584260 1.449360 0.114842 0.172995 0.399303 0.336744
818 -1.745277 -0.871199 1.584610 -0.325737 0.265533 1.023417 -0.845218 -0.359655 0.114898 -0.261679
819 -1.181370 -0.668430 0.704369 -0.621972 0.817714 0.747889 -0.908323 -0.890765 -0.039383 -0.302777
820 3.684930 1.542738 0.831245 -0.245326 -1.192567 -0.701508 -0.814872 -0.145993 -0.521028 -0.263665
821 -5.206740 0.260931 -0.090595 1.323420 -0.216791 1.592575 -0.269524 0.661270 -0.119912 0.536957
822 1.188557 -3.003934 -0.467525 0.304057 -0.762935 -0.382360 -0.062865 0.432218 0.218830 -0.009286
823 -4.063477 -0.620148 -0.317755 -0.265195 0.289793 1.013745 0.187569 0.218072 -0.646222 -0.056226
824 -4.827081 0.886083 -0.627194 -0.866613 -0.636002 0.070826 -0.357138 0.358788 0.111021 0.409414
825 1.707557 0.878078 2.087862 -0.310010 -0.669572 0.166777 -0.380026 -0.600151 -0.269038 -0.320494
826 -1.499015 -2.083250 -0.787003 0.784446 -1.296621 -1.277055 0.004368 -0.456555 0.343666 0.032185
827 -4.837830 1.481881 -0.733343 -0.978912 -2.361642 -0.797906 0.185510 -0.188182 0.743947 0.766924
828 3.033036 0.705130 -0.389919 -1.574643 0.209729 0.021319 0.765114 0.217147 -0.246131 -0.003039
829 0.122792 1.567233 -0.977652 -1.115668 -1.620393 0.379423 -0.004898 0.510600 -0.099833 -0.014748
830 1.855556 -3.484626 1.284401 0.801309 0.125608 -0.820507 -0.182202 0.790208 0.382914 -0.023531
831 -0.277275 -2.288944 -1.354035 1.089162 0.899970 -0.061363 0.681133 0.985985 0.424079 0.168675
832 -4.403996 -0.139996 -1.285791 -1.332565 0.881776 0.124027 -1.032775 -0.140730 -0.079276 -0.554288
833 0.690137 1.007057 -1.003712 -0.343330 0.651197 -0.682697 0.303735 -0.604438 -0.523644 0.163910
834 4.997484 3.005446 -0.987295 -0.646424 2.115080 -0.092983 -0.618173 -0.127452 0.655287 0.067274
835 -5.487794 4.628971 0.453431 0.084096 0.890179 -2.143347 0.583285 0.289075 -0.440414 -0.772229
836 2.137965 0.334246 -0.144015 -0.030711 -1.001528 -0.024629 0.965952 0.155177 0.071355 -0.167304
837 0.333708 -0.836669 -1.859203 -0.284751 0.409917 -0.450083 0.160432 -0.309780 -0.150719 0.051627
838 1.102035 -0.367467 0.964848 -1.144783 -1.465685 0.199780 0.294055 0.690354 -0.015314 -0.223167
839 1.819195 -1.940083 -1.679162 0.201398 -0.174617 0.008454 0.643836 -0.051680 -0.090103 -0.101435
840 3.688505 -3.445325 1.608251 -1.737687 0.405009 -0.671099 0.418150 0.380292 -0.047240 -0.161100
841 0.388538 -0.638758 1.463537 -0.285376 0.812558 0.910231 -0.869405 -0.222378 -0.150848 -0.251405
842 0.040005 -0.194370 0.567197 0.246158 -1.921314 1.451552 0.300678 0.319749 0.157604 0.012214
843 -5.118793 -0.182603 -0.510318 0.991192 -1.323327 -0.170833 -0.882832 0.389255 0.089245 0.547767
844 3.298383 -1.104088 1.934292 -0.438700 -0.501694 -0.018225 0.261371 -0.452803 -0.838817 -0.312177
845 4.969238 0.420677 1.309316 -0.290674 -0.175180 -0.385151 0.393957 0.218393 -0.602388 0.129553
In [89]:
# Now that we have our PCA reduced data , we can now train the SVM model and find out how well does it perform
In [90]:
# Split the data based on reduced data set
x_train_pca, x_test_pca, y_train_pca, y_test_pca = train_test_split(x_reduced_pca,y,test_size=0.30, random_state=1)
In [91]:
# Lets create SVM model with reduced dimensions

# Building a Support Vector Machine on train data
svc_model = SVC(C= .1, kernel='linear', gamma= 1)
svc_model.fit(x_train_pca, y_train_pca)

y_pred = svc_model.predict(x_test_pca)
print ('Accuracy of SVC model with reduced dimensions is:', accuracy_score(y_test_pca, y_pred)*100 )
print ('classification report of this model is:' )
print(metrics.classification_report(y_test_pca, y_pred))
Accuracy of SVC model with reduced dimensions is: 88.9763779527559
classification report of this model is:
              precision    recall  f1-score   support

         bus       0.85      0.90      0.88        59
         car       0.90      0.91      0.90       133
         van       0.91      0.84      0.87        62

    accuracy                           0.89       254
   macro avg       0.89      0.88      0.88       254
weighted avg       0.89      0.89      0.89       254

In [92]:
#Plotting the confusion Matrix
plot_confusion_matrix(svc_model,x_test_pca,y_test_pca)
Out[92]:
<sklearn.metrics._plot.confusion_matrix.ConfusionMatrixDisplay at 0x1a31f985d00>
In [93]:
# we can see that after reducing dimensions the model accuracy is 88.97% 
#under which it successfully predicted 90%, 91% and 84% correct bus,car and van silhouette respectively.
# For Bus: Model correctly predicted 53 observations as bus, and incorrectly predicted 5 cars and 1 van
# For Car: Model correctly predicted 121 observations as car, and incorrectly predicted 8 bus and 4 van
# For Van: Model correctly predicted 52 observations as van, and incorrectly predicted 1 bus and 9 car

From above we can see that with reduced number of dimensions the model's performance is close to 89% and without reducing the dimensions models accuracy is 90%, Based on the project context, we can easily compromise on 1% of the model's performance as against the time and resources being used by the model.

We can observe that from 18 dimensions using PCA we were able to reduce dimensions and come down to 10 dimensions. Based on the business decisions we can further reduce the dimensions or increase the dimensions considering any one of the two factors.

Part 4

DOMAIN: Sports management
CONTEXT: Company X is a sports management company for international cricket.
PROJECT OBJECTIVE: Goal is to build a data driven batsman ranking model for the sports management company to make business decisions.

import libraries that will be used for EDA

import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline from scipy.stats import zscore from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn import preprocessing from sklearn.metrics import average_precision_score, confusion_matrix, accuracy_score, classification_report, plot_confusion_matrix import warnings warnings.filterwarnings('ignore') pd.set_option('display.max_rows', None)

In [94]:
cricket = pd.read_csv('Part4 - batting_bowling_ipl_bat.csv')
In [95]:
cricket.head()
# we can see that there are entire null rows in the data set
Out[95]:
Name Runs Ave SR Fours Sixes HF
0 NaN NaN NaN NaN NaN NaN NaN
1 CH Gayle 733.0 61.08 160.74 46.0 59.0 9.0
2 NaN NaN NaN NaN NaN NaN NaN
3 G Gambhir 590.0 36.87 143.55 64.0 17.0 6.0
4 NaN NaN NaN NaN NaN NaN NaN
In [96]:
cricket.shape
# shape of the dataset
Out[96]:
(180, 7)
In [97]:
cricket.info()
# clearly we have 90 non null records in each feature out of total 180 records
# looking at the head, we can say hat every alternate record is a null record
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 180 entries, 0 to 179
Data columns (total 7 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Name    90 non-null     object 
 1   Runs    90 non-null     float64
 2   Ave     90 non-null     float64
 3   SR      90 non-null     float64
 4   Fours   90 non-null     float64
 5   Sixes   90 non-null     float64
 6   HF      90 non-null     float64
dtypes: float64(6), object(1)
memory usage: 10.0+ KB
In [98]:
cricket.isnull().sum()
# we can confirm that there are 90 null records and 90 non null records by lookin gat above and below values
Out[98]:
Name     90
Runs     90
Ave      90
SR       90
Fours    90
Sixes    90
HF       90
dtype: int64
In [99]:
cricket.dropna(axis=0, inplace = True)
#lets drop the null records 
In [100]:
cricket.shape
#rechecking the shape of the data set
Out[100]:
(90, 7)
In [101]:
cricket.info()
#recheck the head to find if we have any null values, clearly all the null records are now dropped and we have 
# data set ready for further EDA
<class 'pandas.core.frame.DataFrame'>
Int64Index: 90 entries, 1 to 179
Data columns (total 7 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Name    90 non-null     object 
 1   Runs    90 non-null     float64
 2   Ave     90 non-null     float64
 3   SR      90 non-null     float64
 4   Fours   90 non-null     float64
 5   Sixes   90 non-null     float64
 6   HF      90 non-null     float64
dtypes: float64(6), object(1)
memory usage: 5.6+ KB
In [102]:
cricket.describe().T
# we can see that that almost all the columns have outliers since max value is much higher than 75% of the data
Out[102]:
count mean std min 25% 50% 75% max
Runs 90.0 219.933333 156.253669 2.00 98.000 196.500 330.7500 733.00
Ave 90.0 24.729889 13.619215 0.50 14.665 24.440 32.1950 81.33
SR 90.0 119.164111 23.656547 18.18 108.745 120.135 131.9975 164.10
Fours 90.0 19.788889 16.399845 0.00 6.250 16.000 28.0000 73.00
Sixes 90.0 7.577778 8.001373 0.00 3.000 6.000 10.0000 59.00
HF 90.0 1.188889 1.688656 0.00 0.000 0.500 2.0000 9.00
In [103]:
#Lets check the distribution of each feature
cricket.hist(color='lightblue', edgecolor = 'black', alpha = 0.7, figsize = (20,10), layout=(3,3))
plt.tight_layout()
plt.show()
#we can see that distribution is not at all normal for all columns
In [104]:
cricket.skew()
# We can see that except for Runs all the other columns are highly skewed
Out[104]:
Runs     0.754618
Ave      1.038076
SR      -1.166175
Fours    1.107192
Sixes    3.226595
HF       2.001199
dtype: float64
In [105]:
#Lets check for the outliers in teh dataset
for columns in cricket.columns[1:7]:
    plt.figure()
    plt.title(columns)
    sns.boxplot(data = cricket[columns].values, orient="h" , color = 'pink')

# we can see that all columns have presence of outliers, sinceour objective is to rank the batsman
# we will require the the extrem values to score the batsman
In [106]:
# Lets check the correlation of each column
sns.pairplot(cricket, diag_kind = 'kde')
# we can see that almost all the columns support each other positively and there is no negative slope or correlation 
Out[106]:
<seaborn.axisgrid.PairGrid at 0x1a320114c70>
In [107]:
cricket.corr()
# We can see from below that our data set is pretty much real where in,
# runs is positively correlated with all the other features, meaning if the Batsman scores more run he is likely to have 
# better Average, Strike rate, Fours, Sixes and half century
# similarly, if the Bats man hits half century, he will likely to have good numbers on runs, average, SR, fours and sixes.
Out[107]:
Runs Ave SR Fours Sixes HF
Runs 1.000000 0.692984 0.493489 0.918809 0.769778 0.835148
Ave 0.692984 1.000000 0.623606 0.546211 0.682414 0.620754
SR 0.493489 0.623606 1.000000 0.384810 0.583943 0.427584
Fours 0.918809 0.546211 0.384810 1.000000 0.522574 0.783689
Sixes 0.769778 0.682414 0.583943 0.522574 1.000000 0.767696
HF 0.835148 0.620754 0.427584 0.783689 0.767696 1.000000

Since all the column is a clear attribute of a good batsman, we should not neglect any of the columns
we can assign each bats man a score from 1 to 4 his performance on each column
then find out the best one based on the total score earned by each batsman
This way, batsman will be measured on each attribute like Runs, Average, Strike Rate, Fours, sixes and Half Centuries

In [108]:
#Creating new dataframe for score calculation
temp = cricket.copy()
temp1 = cricket.copy()
temp.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 90 entries, 1 to 179
Data columns (total 7 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Name    90 non-null     object 
 1   Runs    90 non-null     float64
 2   Ave     90 non-null     float64
 3   SR      90 non-null     float64
 4   Fours   90 non-null     float64
 5   Sixes   90 non-null     float64
 6   HF      90 non-null     float64
dtypes: float64(6), object(1)
memory usage: 5.6+ KB
In [109]:
# Calculating scores based on the performance of each player
for columns in temp.columns[1:7]:
    #find 1st, 2nd and 3rd quartile
    q1 = temp[columns].quantile(0.25)
    q2 = temp[columns].quantile(0.50)
    q3 = temp[columns].quantile(0.75)
    print("quartile values for", columns, "is",q1,q2,q3)
    
    #replace each value with score 1 to 5 based on below criteria
    temp.loc[(temp[columns].values < q1) , columns] = 0
    temp.loc[(temp[columns].values >= q1) & (temp[columns].values < q2) , columns] = 1
    temp.loc[(temp[columns].values >= q2) & (temp[columns].values <= q3) , columns] = 2
    temp.loc[(temp[columns].values > q3) , columns] = 4
    #Calculate the score
   
quartile values for Runs is 98.0 196.5 330.75
quartile values for Ave is 14.665 24.44 32.19499999999999
quartile values for SR is 108.745 120.13499999999999 131.9975
quartile values for Fours is 6.25 16.0 28.0
quartile values for Sixes is 3.0 6.0 10.0
quartile values for HF is 0.0 0.5 2.0
In [110]:
#temp.drop(labels = 'Score', axis = 1, inplace = True)
temp['Score'] = temp.sum(axis = 1)
In [111]:
# Take a look at the data
temp.head(10)
Out[111]:
Name Runs Ave SR Fours Sixes HF Score
1 CH Gayle 4.0 4.0 4.0 4.0 4.0 4.0 24.0
3 G Gambhir 4.0 4.0 4.0 4.0 4.0 4.0 24.0
5 V Sehwag 4.0 4.0 4.0 4.0 4.0 4.0 24.0
7 CL White 4.0 4.0 4.0 4.0 4.0 4.0 24.0
9 S Dhawan 4.0 4.0 2.0 4.0 4.0 4.0 22.0
11 AM Rahane 4.0 4.0 2.0 4.0 2.0 4.0 20.0
13 KP Pietersen 2.0 4.0 4.0 2.0 4.0 4.0 20.0
15 RG Sharma 4.0 2.0 2.0 4.0 4.0 4.0 20.0
17 AB de Villiers 2.0 4.0 4.0 2.0 4.0 4.0 20.0
19 JP Duminy 2.0 4.0 2.0 1.0 4.0 2.0 15.0
In [112]:
#Check the batsman with same scores
temp['Score'].value_counts()
Out[112]:
2.0     11
20.0     9
9.0      9
15.0     7
10.0     7
14.0     6
12.0     5
8.0      5
3.0      5
16.0     4
24.0     4
5.0      4
6.0      4
22.0     3
7.0      2
18.0     2
4.0      2
13.0     1
Name: Score, dtype: int64
In [113]:
#Copy the score volumn to original dataset before assigning Ranks
cricket['Score'] = temp['Score']
cricket.head(20)
Out[113]:
Name Runs Ave SR Fours Sixes HF Score
1 CH Gayle 733.0 61.08 160.74 46.0 59.0 9.0 24.0
3 G Gambhir 590.0 36.87 143.55 64.0 17.0 6.0 24.0
5 V Sehwag 495.0 33.00 161.23 57.0 19.0 5.0 24.0
7 CL White 479.0 43.54 149.68 41.0 20.0 5.0 24.0
9 S Dhawan 569.0 40.64 129.61 58.0 18.0 5.0 22.0
11 AM Rahane 560.0 40.00 129.33 73.0 10.0 5.0 20.0
13 KP Pietersen 305.0 61.00 147.34 22.0 20.0 3.0 20.0
15 RG Sharma 433.0 30.92 126.60 39.0 18.0 5.0 20.0
17 AB de Villiers 319.0 39.87 161.11 26.0 15.0 3.0 20.0
19 JP Duminy 244.0 81.33 128.42 13.0 11.0 2.0 15.0
21 DA Warner 256.0 36.57 164.10 28.0 14.0 3.0 20.0
23 SR Watson 255.0 42.50 151.78 26.0 14.0 2.0 18.0
25 F du Plessis 398.0 33.16 130.92 29.0 17.0 3.0 22.0
27 OA Shah 340.0 37.77 132.81 24.0 16.0 3.0 22.0
29 DJ Bravo 371.0 46.37 140.53 20.0 20.0 0.0 20.0
31 DJ Hussey 396.0 33.00 129.83 28.0 17.0 2.0 18.0
33 SK Raina 441.0 25.94 135.69 36.0 19.0 1.0 20.0
35 AT Rayudu 333.0 37.00 132.14 21.0 14.0 2.0 20.0
37 Mandeep Singh 432.0 27.00 126.31 53.0 7.0 2.0 16.0
39 R Dravid 462.0 28.87 112.13 63.0 4.0 2.0 14.0
In [114]:
#Sort the batsman with highest score and for the batsman with same score, 
# one with higher Average will preceed other  
cricket.sort_values(['Score','Ave'] ,ascending=[False,False], inplace= True)
cricket.head(20)
Out[114]:
Name Runs Ave SR Fours Sixes HF Score
1 CH Gayle 733.0 61.08 160.74 46.0 59.0 9.0 24.0
7 CL White 479.0 43.54 149.68 41.0 20.0 5.0 24.0
3 G Gambhir 590.0 36.87 143.55 64.0 17.0 6.0 24.0
5 V Sehwag 495.0 33.00 161.23 57.0 19.0 5.0 24.0
9 S Dhawan 569.0 40.64 129.61 58.0 18.0 5.0 22.0
27 OA Shah 340.0 37.77 132.81 24.0 16.0 3.0 22.0
25 F du Plessis 398.0 33.16 130.92 29.0 17.0 3.0 22.0
13 KP Pietersen 305.0 61.00 147.34 22.0 20.0 3.0 20.0
29 DJ Bravo 371.0 46.37 140.53 20.0 20.0 0.0 20.0
45 SPD Smith 362.0 40.22 135.58 24.0 14.0 0.0 20.0
11 AM Rahane 560.0 40.00 129.33 73.0 10.0 5.0 20.0
17 AB de Villiers 319.0 39.87 161.11 26.0 15.0 3.0 20.0
35 AT Rayudu 333.0 37.00 132.14 21.0 14.0 2.0 20.0
21 DA Warner 256.0 36.57 164.10 28.0 14.0 3.0 20.0
15 RG Sharma 433.0 30.92 126.60 39.0 18.0 5.0 20.0
33 SK Raina 441.0 25.94 135.69 36.0 19.0 1.0 20.0
23 SR Watson 255.0 42.50 151.78 26.0 14.0 2.0 18.0
31 DJ Hussey 396.0 33.00 129.83 28.0 17.0 2.0 18.0
47 TM Dilshan 285.0 35.62 109.19 33.0 5.0 3.0 16.0
55 DMD Jayawardene 335.0 27.91 112.41 39.0 3.0 3.0 16.0
In [115]:
#Assigning the Rank to all 90 Batsman
cricket['Rank'] = range(1,91)
cricket
Out[115]:
Name Runs Ave SR Fours Sixes HF Score Rank
1 CH Gayle 733.0 61.08 160.74 46.0 59.0 9.0 24.0 1
7 CL White 479.0 43.54 149.68 41.0 20.0 5.0 24.0 2
3 G Gambhir 590.0 36.87 143.55 64.0 17.0 6.0 24.0 3
5 V Sehwag 495.0 33.00 161.23 57.0 19.0 5.0 24.0 4
9 S Dhawan 569.0 40.64 129.61 58.0 18.0 5.0 22.0 5
27 OA Shah 340.0 37.77 132.81 24.0 16.0 3.0 22.0 6
25 F du Plessis 398.0 33.16 130.92 29.0 17.0 3.0 22.0 7
13 KP Pietersen 305.0 61.00 147.34 22.0 20.0 3.0 20.0 8
29 DJ Bravo 371.0 46.37 140.53 20.0 20.0 0.0 20.0 9
45 SPD Smith 362.0 40.22 135.58 24.0 14.0 0.0 20.0 10
11 AM Rahane 560.0 40.00 129.33 73.0 10.0 5.0 20.0 11
17 AB de Villiers 319.0 39.87 161.11 26.0 15.0 3.0 20.0 12
35 AT Rayudu 333.0 37.00 132.14 21.0 14.0 2.0 20.0 13
21 DA Warner 256.0 36.57 164.10 28.0 14.0 3.0 20.0 14
15 RG Sharma 433.0 30.92 126.60 39.0 18.0 5.0 20.0 15
33 SK Raina 441.0 25.94 135.69 36.0 19.0 1.0 20.0 16
23 SR Watson 255.0 42.50 151.78 26.0 14.0 2.0 18.0 17
31 DJ Hussey 396.0 33.00 129.83 28.0 17.0 2.0 18.0 18
47 TM Dilshan 285.0 35.62 109.19 33.0 5.0 3.0 16.0 19
55 DMD Jayawardene 335.0 27.91 112.41 39.0 3.0 3.0 16.0 20
37 Mandeep Singh 432.0 27.00 126.31 53.0 7.0 2.0 16.0 21
43 M Vijay 336.0 25.84 125.84 39.0 10.0 2.0 16.0 22
19 JP Duminy 244.0 81.33 128.42 13.0 11.0 2.0 15.0 23
41 DR Smith 157.0 39.25 160.20 18.0 7.0 1.0 15.0 24
51 SE Marsh 336.0 30.54 120.00 39.0 7.0 2.0 15.0 25
57 V Kohli 364.0 28.00 111.65 33.0 9.0 2.0 15.0 26
49 RV Uthappa 405.0 27.00 118.07 38.0 10.0 2.0 15.0 27
53 KA Pollard 220.0 24.44 138.36 15.0 14.0 2.0 15.0 28
59 MA Agarwal 225.0 20.45 142.40 19.0 15.0 1.0 15.0 29
77 DB Das 126.0 42.00 135.48 9.0 6.0 0.0 14.0 30
73 BJ Hodge 245.0 30.62 140.00 18.0 9.0 0.0 14.0 31
69 MS Bisla 213.0 30.42 133.12 16.0 10.0 1.0 14.0 32
67 MS Dhoni 357.0 29.75 128.41 26.0 9.0 1.0 14.0 33
39 R Dravid 462.0 28.87 112.13 63.0 4.0 2.0 14.0 34
65 JH Kallis 409.0 25.56 106.51 34.0 10.0 2.0 14.0 35
63 MEK Hussey 261.0 32.62 110.59 28.0 8.0 2.0 13.0 36
79 AC Gilchrist 172.0 34.40 120.27 21.0 4.0 1.0 12.0 37
61 SR Tendulkar 324.0 29.45 114.48 39.0 4.0 2.0 12.0 38
71 JD Ryder 256.0 25.60 120.75 23.0 8.0 2.0 12.0 39
83 IK Pathan 176.0 25.14 139.68 14.0 6.0 0.0 12.0 40
75 NV Ojha 255.0 23.18 113.83 21.0 13.0 1.0 12.0 41
91 DA Miller 98.0 32.66 130.66 6.0 4.0 0.0 10.0 42
101 DT Christian 145.0 29.00 122.88 8.0 6.0 0.0 10.0 43
81 BB McCullum 289.0 24.08 102.12 37.0 3.0 1.0 10.0 44
85 Azhar Mahmood 186.0 23.25 130.98 16.0 8.0 0.0 10.0 45
115 KD Karthik 238.0 18.30 111.73 30.0 2.0 0.0 10.0 46
121 SC Ganguly 268.0 17.86 98.89 30.0 4.0 0.0 10.0 47
95 JA Morkel 107.0 15.28 157.35 5.0 6.0 0.0 10.0 48
99 M Manhas 120.0 30.00 125.00 10.0 4.0 0.0 9.0 49
93 MK Tiwary 260.0 26.00 105.69 21.0 3.0 1.0 9.0 50
105 JEC Franklin 220.0 24.44 98.65 15.0 6.0 1.0 9.0 51
111 STR Binny 90.0 22.50 134.32 9.0 3.0 0.0 9.0 52
87 MK Pandey 143.0 20.42 127.67 12.0 6.0 1.0 9.0 53
117 AL Menaria 220.0 20.00 108.91 14.0 8.0 0.0 9.0 54
97 LRPL Taylor 197.0 19.70 115.20 12.0 7.0 1.0 9.0 55
103 RA Jadeja 191.0 15.91 126.49 13.0 9.0 0.0 9.0 56
125 Harbhajan Singh 108.0 12.00 135.00 14.0 3.0 0.0 9.0 57
109 Y Nagar 153.0 30.60 115.03 13.0 3.0 0.0 8.0 58
113 SS Tiwary 191.0 23.87 112.35 9.0 8.0 0.0 8.0 59
123 YK Pathan 194.0 19.40 114.79 10.0 7.0 0.0 8.0 60
107 KC Sangakkara 200.0 18.18 108.69 21.0 4.0 1.0 8.0 61
119 PA Patel 194.0 17.63 117.57 19.0 4.0 0.0 8.0 62
89 S Badrinath 196.0 28.00 108.28 23.0 2.0 1.0 7.0 63
135 PP Chawla 106.0 13.25 120.45 9.0 4.0 0.0 7.0 64
131 Y Venugopal Rao 132.0 22.00 104.76 8.0 5.0 0.0 6.0 65
133 AD Mathews 127.0 18.14 117.59 5.0 4.0 0.0 6.0 66
141 MN Samuels 124.0 17.71 100.81 7.0 5.0 0.0 6.0 67
137 Shakib Al Hasan 91.0 15.16 122.97 6.0 3.0 0.0 6.0 68
143 MJ Clarke 98.0 16.33 104.25 12.0 0.0 0.0 5.0 69
139 N Saini 140.0 14.00 99.29 16.0 0.0 1.0 5.0 70
127 RE Levi 83.0 13.83 113.69 10.0 4.0 1.0 5.0 71
129 LR Shukla 75.0 12.50 131.57 4.0 5.0 0.0 5.0 72
145 R Bhatia 35.0 11.66 125.00 4.0 0.0 0.0 4.0 73
153 A Ashish Reddy 35.0 8.75 120.68 3.0 1.0 0.0 4.0 74
147 R Vinay Kumar 68.0 13.60 109.67 3.0 2.0 0.0 3.0 75
149 P Kumar 35.0 11.66 116.66 2.0 1.0 0.0 3.0 76
159 SL Malinga 55.0 9.16 103.77 4.0 3.0 0.0 3.0 77
155 DL Vettori 31.0 7.75 119.23 3.0 1.0 0.0 3.0 78
163 R Ashwin 18.0 6.00 120.00 2.0 0.0 0.0 3.0 79
151 J Botha 58.0 14.50 107.40 4.0 1.0 0.0 2.0 80
157 SP Goswami 69.0 13.80 102.98 4.0 1.0 0.0 2.0 81
165 B Kumar 40.0 13.33 100.00 4.0 0.0 0.0 2.0 82
161 RJ Peterson 32.0 10.66 106.66 3.0 1.0 0.0 2.0 83
171 Z Khan 12.0 6.00 70.58 1.0 0.0 0.0 2.0 84
169 A Mishra 16.0 5.33 80.00 1.0 0.0 0.0 2.0 85
175 PC Valthaty 30.0 5.00 58.82 4.0 0.0 0.0 2.0 86
173 WD Parnell 19.0 4.75 70.37 2.0 0.0 0.0 2.0 87
167 DW Steyn 19.0 3.80 90.47 0.0 1.0 0.0 2.0 88
177 RP Singh 6.0 3.00 50.00 0.0 0.0 0.0 2.0 89
179 R Sharma 2.0 0.50 18.18 0.0 0.0 0.0 2.0 90
In [116]:
temp1.drop(labels ='Name', axis = 1, inplace = True)
XScaled  =temp1.apply(zscore)
XScaled.head()
Out[116]:
Runs Ave SR Fours Sixes HF
1 3.301945 2.683984 1.767325 1.607207 6.462679 4.651551
3 2.381639 0.896390 1.036605 2.710928 1.184173 2.865038
5 1.770248 0.610640 1.788154 2.281703 1.435530 2.269533
7 1.667276 1.388883 1.297182 1.300618 1.561209 2.269533
9 2.246490 1.174755 0.444038 2.343021 1.309851 2.269533
In [117]:
# Creating single dimension which will represent all the features using PCA technique
pca3 = PCA(n_components=1)
pca3.fit(XScaled)
print(pca3.components_) 
print(pca3.explained_variance_ratio_)
Xpca3 = pca3.transform(XScaled)
[[0.4582608  0.39797313 0.3253838  0.40574167 0.41733459 0.43237178]]
[0.70911996]
In [118]:
Xpca3
Out[118]:
array([[ 8.51677407],
       [ 4.61833957],
       [ 4.1422505 ],
       [ 3.89941107],
       [ 4.12007165],
       [ 4.02443639],
       [ 2.87928084],
       [ 2.91901518],
       [ 2.3273886 ],
       [ 2.08164241],
       [ 2.08328069],
       [ 1.77694308],
       [ 2.12516667],
       [ 1.93887249],
       [ 1.72763623],
       [ 1.81713174],
       [ 1.86989515],
       [ 1.44931719],
       [ 1.7957849 ],
       [ 1.83452229],
       [ 0.68521512],
       [ 1.28111282],
       [ 1.23672458],
       [ 1.03374737],
       [ 1.38634619],
       [ 1.18109656],
       [ 0.68373376],
       [ 1.04356191],
       [ 1.02916835],
       [ 0.53160014],
       [ 0.87997561],
       [ 0.66964957],
       [ 1.09641905],
       [ 0.86013096],
       [ 0.32393465],
       [ 0.46475228],
       [ 0.25917713],
       [ 0.24998938],
       [-0.20115976],
       [-0.04807084],
       [ 0.0883086 ],
       [-0.36664347],
       [-0.35836507],
       [-0.56106199],
       [-0.38633634],
       [-0.8044013 ],
       [-0.28948789],
       [-0.83938715],
       [-0.54299019],
       [-0.79645257],
       [-0.72628805],
       [-0.64359706],
       [-0.54259693],
       [-0.60228889],
       [-0.79720994],
       [-1.05373734],
       [-0.75723616],
       [-0.58311079],
       [-0.70861363],
       [-0.8205596 ],
       [-0.58026028],
       [-0.87356201],
       [-1.17539392],
       [-1.27968755],
       [-1.44935985],
       [-1.27340186],
       [-1.35120355],
       [-1.41775582],
       [-1.49810076],
       [-1.36628544],
       [-1.50257181],
       [-1.71007725],
       [-1.94513625],
       [-1.92282113],
       [-2.05779966],
       [-1.9848353 ],
       [-2.06282844],
       [-2.12406626],
       [-2.03409882],
       [-2.09590808],
       [-2.20946881],
       [-2.28050924],
       [-2.22710562],
       [-2.74796128],
       [-2.88423691],
       [-3.00663897],
       [-3.00075124],
       [-3.07095944],
       [-3.42202228],
       [-3.94740198]])
In [119]:
temp1['Name'] = temp['Name']
temp1['PCA dimension'] = Xpca3
temp1.head()
Out[119]:
Runs Ave SR Fours Sixes HF Name PCA dimension
1 733.0 61.08 160.74 46.0 59.0 9.0 CH Gayle 8.516774
3 590.0 36.87 143.55 64.0 17.0 6.0 G Gambhir 4.618340
5 495.0 33.00 161.23 57.0 19.0 5.0 V Sehwag 4.142251
7 479.0 43.54 149.68 41.0 20.0 5.0 CL White 3.899411
9 569.0 40.64 129.61 58.0 18.0 5.0 S Dhawan 4.120072
In [120]:
temp1.sort_values(['PCA dimension'] ,ascending=[False], inplace= True)
temp1.head(20)
Out[120]:
Runs Ave SR Fours Sixes HF Name PCA dimension
1 733.0 61.08 160.74 46.0 59.0 9.0 CH Gayle 8.516774
3 590.0 36.87 143.55 64.0 17.0 6.0 G Gambhir 4.618340
5 495.0 33.00 161.23 57.0 19.0 5.0 V Sehwag 4.142251
9 569.0 40.64 129.61 58.0 18.0 5.0 S Dhawan 4.120072
11 560.0 40.00 129.33 73.0 10.0 5.0 AM Rahane 4.024436
7 479.0 43.54 149.68 41.0 20.0 5.0 CL White 3.899411
15 433.0 30.92 126.60 39.0 18.0 5.0 RG Sharma 2.919015
13 305.0 61.00 147.34 22.0 20.0 3.0 KP Pietersen 2.879281
17 319.0 39.87 161.11 26.0 15.0 3.0 AB de Villiers 2.327389
25 398.0 33.16 130.92 29.0 17.0 3.0 F du Plessis 2.125167
21 256.0 36.57 164.10 28.0 14.0 3.0 DA Warner 2.083281
19 244.0 81.33 128.42 13.0 11.0 2.0 JP Duminy 2.081642
27 340.0 37.77 132.81 24.0 16.0 3.0 OA Shah 1.938872
33 441.0 25.94 135.69 36.0 19.0 1.0 SK Raina 1.869895
39 462.0 28.87 112.13 63.0 4.0 2.0 R Dravid 1.834522
31 396.0 33.00 129.83 28.0 17.0 2.0 DJ Hussey 1.817132
37 432.0 27.00 126.31 53.0 7.0 2.0 Mandeep Singh 1.795785
23 255.0 42.50 151.78 26.0 14.0 2.0 SR Watson 1.776943
29 371.0 46.37 140.53 20.0 20.0 0.0 DJ Bravo 1.727636
35 333.0 37.00 132.14 21.0 14.0 2.0 AT Rayudu 1.449317
In [121]:
temp1['Rank'] = range(1,91)
temp1
Out[121]:
Runs Ave SR Fours Sixes HF Name PCA dimension Rank
1 733.0 61.08 160.74 46.0 59.0 9.0 CH Gayle 8.516774 1
3 590.0 36.87 143.55 64.0 17.0 6.0 G Gambhir 4.618340 2
5 495.0 33.00 161.23 57.0 19.0 5.0 V Sehwag 4.142251 3
9 569.0 40.64 129.61 58.0 18.0 5.0 S Dhawan 4.120072 4
11 560.0 40.00 129.33 73.0 10.0 5.0 AM Rahane 4.024436 5
7 479.0 43.54 149.68 41.0 20.0 5.0 CL White 3.899411 6
15 433.0 30.92 126.60 39.0 18.0 5.0 RG Sharma 2.919015 7
13 305.0 61.00 147.34 22.0 20.0 3.0 KP Pietersen 2.879281 8
17 319.0 39.87 161.11 26.0 15.0 3.0 AB de Villiers 2.327389 9
25 398.0 33.16 130.92 29.0 17.0 3.0 F du Plessis 2.125167 10
21 256.0 36.57 164.10 28.0 14.0 3.0 DA Warner 2.083281 11
19 244.0 81.33 128.42 13.0 11.0 2.0 JP Duminy 2.081642 12
27 340.0 37.77 132.81 24.0 16.0 3.0 OA Shah 1.938872 13
33 441.0 25.94 135.69 36.0 19.0 1.0 SK Raina 1.869895 14
39 462.0 28.87 112.13 63.0 4.0 2.0 R Dravid 1.834522 15
31 396.0 33.00 129.83 28.0 17.0 2.0 DJ Hussey 1.817132 16
37 432.0 27.00 126.31 53.0 7.0 2.0 Mandeep Singh 1.795785 17
23 255.0 42.50 151.78 26.0 14.0 2.0 SR Watson 1.776943 18
29 371.0 46.37 140.53 20.0 20.0 0.0 DJ Bravo 1.727636 19
35 333.0 37.00 132.14 21.0 14.0 2.0 AT Rayudu 1.449317 20
49 405.0 27.00 118.07 38.0 10.0 2.0 RV Uthappa 1.386346 21
43 336.0 25.84 125.84 39.0 10.0 2.0 M Vijay 1.281113 22
45 362.0 40.22 135.58 24.0 14.0 0.0 SPD Smith 1.236725 23
51 336.0 30.54 120.00 39.0 7.0 2.0 SE Marsh 1.181097 24
65 409.0 25.56 106.51 34.0 10.0 2.0 JH Kallis 1.096419 25
55 335.0 27.91 112.41 39.0 3.0 3.0 DMD Jayawardene 1.043562 26
47 285.0 35.62 109.19 33.0 5.0 3.0 TM Dilshan 1.033747 27
57 364.0 28.00 111.65 33.0 9.0 2.0 V Kohli 1.029168 28
61 324.0 29.45 114.48 39.0 4.0 2.0 SR Tendulkar 0.879976 29
67 357.0 29.75 128.41 26.0 9.0 1.0 MS Dhoni 0.860131 30
41 157.0 39.25 160.20 18.0 7.0 1.0 DR Smith 0.685215 31
53 220.0 24.44 138.36 15.0 14.0 2.0 KA Pollard 0.683734 32
63 261.0 32.62 110.59 28.0 8.0 2.0 MEK Hussey 0.669650 33
59 225.0 20.45 142.40 19.0 15.0 1.0 MA Agarwal 0.531600 34
71 256.0 25.60 120.75 23.0 8.0 2.0 JD Ryder 0.464752 35
69 213.0 30.42 133.12 16.0 10.0 1.0 MS Bisla 0.323935 36
73 245.0 30.62 140.00 18.0 9.0 0.0 BJ Hodge 0.259177 37
75 255.0 23.18 113.83 21.0 13.0 1.0 NV Ojha 0.249989 38
81 289.0 24.08 102.12 37.0 3.0 1.0 BB McCullum 0.088309 39
79 172.0 34.40 120.27 21.0 4.0 1.0 AC Gilchrist -0.048071 40
77 126.0 42.00 135.48 9.0 6.0 0.0 DB Das -0.201160 41
93 260.0 26.00 105.69 21.0 3.0 1.0 MK Tiwary -0.289488 42
85 186.0 23.25 130.98 16.0 8.0 0.0 Azhar Mahmood -0.358365 43
83 176.0 25.14 139.68 14.0 6.0 0.0 IK Pathan -0.366643 44
89 196.0 28.00 108.28 23.0 2.0 1.0 S Badrinath -0.386336 45
105 220.0 24.44 98.65 15.0 6.0 1.0 JEC Franklin -0.542597 46
97 197.0 19.70 115.20 12.0 7.0 1.0 LRPL Taylor -0.542990 47
87 143.0 20.42 127.67 12.0 6.0 1.0 MK Pandey -0.561062 48
121 268.0 17.86 98.89 30.0 4.0 0.0 SC Ganguly -0.580260 49
115 238.0 18.30 111.73 30.0 2.0 0.0 KD Karthik -0.583111 50
107 200.0 18.18 108.69 21.0 4.0 1.0 KC Sangakkara -0.602289 51
103 191.0 15.91 126.49 13.0 9.0 0.0 RA Jadeja -0.643597 52
117 220.0 20.00 108.91 14.0 8.0 0.0 AL Menaria -0.708614 53
101 145.0 29.00 122.88 8.0 6.0 0.0 DT Christian -0.726288 54
113 191.0 23.87 112.35 9.0 8.0 0.0 SS Tiwary -0.757236 55
99 120.0 30.00 125.00 10.0 4.0 0.0 M Manhas -0.796453 56
109 153.0 30.60 115.03 13.0 3.0 0.0 Y Nagar -0.797210 57
91 98.0 32.66 130.66 6.0 4.0 0.0 DA Miller -0.804401 58
119 194.0 17.63 117.57 19.0 4.0 0.0 PA Patel -0.820560 59
95 107.0 15.28 157.35 5.0 6.0 0.0 JA Morkel -0.839387 60
123 194.0 19.40 114.79 10.0 7.0 0.0 YK Pathan -0.873562 61
111 90.0 22.50 134.32 9.0 3.0 0.0 STR Binny -1.053737 62
125 108.0 12.00 135.00 14.0 3.0 0.0 Harbhajan Singh -1.175394 63
131 132.0 22.00 104.76 8.0 5.0 0.0 Y Venugopal Rao -1.273402 64
127 83.0 13.83 113.69 10.0 4.0 1.0 RE Levi -1.279688 65
133 127.0 18.14 117.59 5.0 4.0 0.0 AD Mathews -1.351204 66
139 140.0 14.00 99.29 16.0 0.0 1.0 N Saini -1.366285 67
135 106.0 13.25 120.45 9.0 4.0 0.0 PP Chawla -1.417756 68
129 75.0 12.50 131.57 4.0 5.0 0.0 LR Shukla -1.449360 69
137 91.0 15.16 122.97 6.0 3.0 0.0 Shakib Al Hasan -1.498101 70
141 124.0 17.71 100.81 7.0 5.0 0.0 MN Samuels -1.502572 71
143 98.0 16.33 104.25 12.0 0.0 0.0 MJ Clarke -1.710077 72
147 68.0 13.60 109.67 3.0 2.0 0.0 R Vinay Kumar -1.922821 73
145 35.0 11.66 125.00 4.0 0.0 0.0 R Bhatia -1.945136 74
151 58.0 14.50 107.40 4.0 1.0 0.0 J Botha -1.984835 75
157 69.0 13.80 102.98 4.0 1.0 0.0 SP Goswami -2.034099 76
149 35.0 11.66 116.66 2.0 1.0 0.0 P Kumar -2.057800 77
153 35.0 8.75 120.68 3.0 1.0 0.0 A Ashish Reddy -2.062828 78
159 55.0 9.16 103.77 4.0 3.0 0.0 SL Malinga -2.095908 79
155 31.0 7.75 119.23 3.0 1.0 0.0 DL Vettori -2.124066 80
161 32.0 10.66 106.66 3.0 1.0 0.0 RJ Peterson -2.209469 81
165 40.0 13.33 100.00 4.0 0.0 0.0 B Kumar -2.227106 82
163 18.0 6.00 120.00 2.0 0.0 0.0 R Ashwin -2.280509 83
167 19.0 3.80 90.47 0.0 1.0 0.0 DW Steyn -2.747961 84
169 16.0 5.33 80.00 1.0 0.0 0.0 A Mishra -2.884237 85
173 19.0 4.75 70.37 2.0 0.0 0.0 WD Parnell -3.000751 86
171 12.0 6.00 70.58 1.0 0.0 0.0 Z Khan -3.006639 87
175 30.0 5.00 58.82 4.0 0.0 0.0 PC Valthaty -3.070959 88
177 6.0 3.00 50.00 0.0 0.0 0.0 RP Singh -3.422022 89
179 2.0 0.50 18.18 0.0 0.0 0.0 R Sharma -3.947402 90

PART 5

Question 1: List down all possible dimensionality reduction techniques that can be implemented using python. Answer:

  1. Variance inflation factor method - Like name suggestes, Higher the VIF factor higher is the variance inflated due to collinearity, hence higher VIF dimension can be dropped
  2. Low Varicance dimensions - Low variance dimensions are the one which will have almost same values across all the records, hence the variance for that particular column will be very low. In case of too many dimensions, this dimensions can be dropped.
  3. Highly correlated dimensions - This dimension are highly correlated with other dimension,so they can be dropped since its purpose in predicting target variable can be served by other dimension.
  4. Random Forest: This techniques tells us the importance of each feature present in the dataset. We can find the importance of each feature and keep the top most features, resulting in dimensionality reduction
  5. Principal Component Analysis: PCA is another technique where in from the Large dats set, we can get newly created dimensions called principal components. These principal components are derived from the entire data set all together and each new PC explains a certain amount of variance. Based on SME suggestions or elbow method, we can further select number of PC that we require for training our model.

Based on research made for finding more techniques for dimension reduction, i found below set of techniques which can be implemented: Independent Component Analysis

  1. Methods Based on Projections
  2. t-Distributed Stochastic Neighbor Embedding (t-SNE)
  3. UMAP
  4. Backward Feature Elimination 10.Forward Feature Selection

So far you have used dimensional reduction on numeric data. Is it possible to do the same on a multimedia data [images and video] and text data ? Please illustrate your findings using a simple implementation on python.

Answer: Yes, it is possible to reduce dimensions on multimedia data as well. For implementation, let's try the PCA approach on inbuild Iris data set.

In [122]:
# The goal of this module is to verify the implentation of PCA on multimedia data, hence we will purely concentrate on 
# verifying models performance before and after applying PCA on iris flower data set. 

#loading iris flower data set
iris = pd.read_csv('iris-1.csv')
iris.head()
Out[122]:
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species
0 1 5.1 3.5 1.4 0.2 Iris-setosa
1 2 4.9 3.0 1.4 0.2 Iris-setosa
2 3 4.7 3.2 1.3 0.2 Iris-setosa
3 4 4.6 3.1 1.5 0.2 Iris-setosa
4 5 5.0 3.6 1.4 0.2 Iris-setosa
In [123]:
iris.shape
Out[123]:
(152, 6)
In [124]:
iris.isnull().sum()
Out[124]:
Id               0
SepalLengthCm    0
SepalWidthCm     0
PetalLengthCm    0
PetalWidthCm     0
Species          0
dtype: int64
In [125]:
iris.describe()
Out[125]:
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm
count 152.000000 152.000000 152.000000 152.000000 152.000000
mean 76.500000 5.843421 3.053618 3.781579 1.210526
std 44.022721 0.822584 0.430736 1.763967 0.765840
min 1.000000 4.300000 2.000000 1.000000 0.100000
25% 38.750000 5.100000 2.800000 1.600000 0.300000
50% 76.500000 5.800000 3.000000 4.400000 1.300000
75% 114.250000 6.400000 3.300000 5.100000 1.800000
max 152.000000 7.900000 4.400000 6.900000 2.500000
In [126]:
iris.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 152 entries, 0 to 151
Data columns (total 6 columns):
 #   Column         Non-Null Count  Dtype  
---  ------         --------------  -----  
 0   Id             152 non-null    int64  
 1   SepalLengthCm  152 non-null    float64
 2   SepalWidthCm   152 non-null    float64
 3   PetalLengthCm  152 non-null    float64
 4   PetalWidthCm   152 non-null    float64
 5   Species        152 non-null    object 
dtypes: float64(4), int64(1), object(1)
memory usage: 7.2+ KB
In [127]:
#Lets split the data into x and y data set
x = iris.drop('Species', axis = 1)
y = iris['Species']
x.shape,y.shape
Out[127]:
((152, 5), (152,))
In [128]:
#applying stanard scalar on x data before splitting into traning and testing data
#Before we start creating clusters, lets scale the data
x_sc = x.apply(zscore)
x_sc.head()
Out[128]:
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm
0 -1.720693 -0.90675 1.039750 -1.354590 -1.323862
1 -1.697902 -1.15069 -0.124893 -1.354590 -1.323862
2 -1.675112 -1.39463 0.340964 -1.411468 -1.323862
3 -1.652321 -1.51660 0.108036 -1.297712 -1.323862
4 -1.629530 -1.02872 1.272678 -1.354590 -1.323862
In [129]:
# Lets split the data into training and testing data
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.3, random_state=1)
In [130]:
#Lets create KNN to predict the Species
from sklearn.neighbors import KNeighborsClassifier

knn = KNeighborsClassifier(n_neighbors=4)
knn.fit(x_train,y_train)
print("Train score before PCA",knn.score(x_train,y_train),"%")
print("Test score before PCA",knn.score(x_test,y_test),"%")
# From the below accuracy it is clear that our data set it very well organized and distributed
#  the species of one kind are lying close to one another there by allowing model to predict accurately with different k values
Train score before PCA 0.9905660377358491 %
Test score before PCA 0.9782608695652174 %
In [131]:
# Now lets try reducing the dimension using PCA and find out the difference in the model performance
from sklearn.decomposition import PCA
pca = PCA()
X_pca = pca.fit_transform(x)
In [132]:
# Lets find the covariance of all dimensions
pca.get_covariance()
Out[132]:
array([[ 1.93800000e+03,  2.54476821e+01, -7.42201987e+00,
         6.85013245e+01,  3.03304636e+01],
       [ 2.54476821e+01,  6.76645173e-01, -3.87343151e-02,
         1.25696410e+00,  5.10334611e-01],
       [-7.42201987e+00, -3.87343151e-02,  1.85533178e-01,
        -3.18111711e-01, -1.16660857e-01],
       [ 6.85013245e+01,  1.25696410e+00, -3.18111711e-01,
         3.11157895e+00,  1.29973161e+00],
       [ 3.03304636e+01,  5.10334611e-01, -1.16660857e-01,
         1.29973161e+00,  5.86510979e-01]])
In [133]:
# from below we can clearly see that 99% of the data is explained by the single dimension 
pca.explained_variance_ratio_
Out[133]:
array([9.99330705e-01, 5.07359283e-04, 1.13291780e-04, 3.64927926e-05,
       1.21510428e-05])
In [134]:
#SInce our data is good and all the species are very well organized, 
# it justifies that PCA's single dimension can very well explain the entire data set.
# So lets try and create single dimension data
pca_1=PCA(n_components=1)
x_pca1=pca_1.fit_transform(x)
In [135]:
# Lets split the data into training and testing data using new PCA dimension
x_train, x_test, y_train, y_test = train_test_split(x_pca1, y, test_size = 0.3, random_state=1)
In [136]:
#Lets create KNN to predict the Species
from sklearn.neighbors import KNeighborsClassifier

knn = KNeighborsClassifier(n_neighbors=4)
knn.fit(x_train,y_train)
print("Train score after PCA",knn.score(x_train,y_train),"%")
print("Test score after PCA",knn.score(x_test,y_test),"%")
# From the below accuracy it is clear that our data set it very well organized and distributed
#  the species of one kind are lying close to one another there by allowing model to predict accurately with different k values
Train score after PCA 0.9905660377358491 %
Test score after PCA 0.9565217391304348 %

We can clearly see that after applying PCA the number of dimensions are reduced from 5 to 1 dimension and the models performance is changed from 97% to 95% which is fairly good accuracy.

In [ ]: